Hello Cloudogu-Team,
this post is regarding some experiences I saw using your Gitops Playground. I used Kubuntu Desktop version of Ubuntu, as I still prefer using KDE.
Environment:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
The Ubuntu system has following packages installed: docker-ce, docker-ce-cli, containerd.io, curl, ssh, ntp, tigervnc-server, lsb-release, gnupg, ca-certificates, apt-transport-https
It seems that the playground will not work if I´ll follow your manual step by step without thinking:
1. Create Cluster:
bash <(curl -s
https://raw.githubusercontent.com/cloudogu/gitops-playground/main/scripts/init-cluster.sh)
As I did not find any specific information, I ran that command as a standard user. The result:
$bash <(curl -s https://raw.githubusercontent.com/cloudogu/gitops-playground/main/scripts/init-cluster.sh)
Initializing k3d-cluster âgitops-playgroundâ
INFO[0000] Hostnetwork selected - disabling injection of docker host into the cluster, server load balancer and setting the api port to the k3s default
ERRO[0000] Failed to get nodes for cluster âgitops-playgroundâ
INFO[0000] Prep: Network
ERRO[0000] Failed to list docker networks
ERRO[0000] Failed to check for duplicate networks
ERRO[0000] Failed to create cluster network
ERRO[0000] Failed Cluster Preparation: Failed Network Preparation: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get âhttp://%2Fvar%2Frun%2Fdocker.sock/v1.24/networks?filters=%7B%22name%22%3A%7B%22%5E%2F%3Fhost%24%22%3Atrue%7D%7Dâ: dial unix /var/run/docker.sock: connect: permission denied
ERRO[0000] Failed to create cluster >>> Rolling Back
INFO[0000] Deleting cluster âgitops-playgroundâ
ERRO[0000] Failed to get nodes for cluster âgitops-playgroundâ
ERRO[0000] No nodes found for given cluster
FATA[0000] Cluster creation FAILED, also FAILED to rollback changes!
OK, easy going - either using root up here, or adding the user to docker group I thought:
#usermod -aG docker playground
#sudo su - playground
$bash <(curl -s https://raw.githubusercontent.com/cloudogu/gitops-playground/main/scripts/init-cluster.sh)
Initializing k3d-cluster âgitops-playgroundâ
INFO[0000] Hostnetwork selected - disabling injection of docker host into the cluster, server load balancer and setting the api port to the k3s default
INFO[0000] Prep: Network
INFO[0000] Re-using existing network âhostâ (4aae9556c61094cf3b096b2389b0cc3f40827985db2b104a593bcc4bc23cfd5d)
INFO[0000] Created volume âk3d-gitops-playground-imagesâ
INFO[0001] Creating node âk3d-gitops-playground-server-0â
INFO[0001] Starting cluster âgitops-playgroundâ
INFO[0001] Starting serversâŚ
INFO[0001] Starting Node âk3d-gitops-playground-server-0â
INFO[0011] Starting agentsâŚ
INFO[0011] Starting helpersâŚ
INFO[0011] Cluster âgitops-playgroundâ created successfully!
INFO[0011] --kubeconfig-update-default=false â sets --kubeconfig-switch-context=false
INFO[0012] You can now use it like this:
kubectl config use-context k3d-gitops-playground
kubectl cluster-info
Adding k3d cluster to ~/.kube/config
Followed your information to run e.g. kubectl cluster-info:
$kubectl cluster
kubectl: command not found
:(, So I did:
#curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
#echo âdeb https://apt.kubernetes.io/ kubernetes-xenial mainâ | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
#apt-get update
#apt-get install -y kubectl
Now, I can use the information lines to get an overview about the cluster.
Next step.
2. Apply Playground:
$docker run --rm -it -v ~/.k3d/kubeconfig-${CLUSTER_NAME}.yaml:/home/.kube/config --net=host ghcr.io/cloudogu/gitops-playground
error: error loading config file â/home/.kube/configâ: open /home/.kube/config: permission denied
Applying gitops playground to kubernetes cluster: ââ.
Continue? y/n [n]
After thinking a bit and switching into the container I started, I became aware, that you are expecting running that docker run with UID 1000. But this is neither the case if I´ll run that command as root user, or in my case using another UID as my test user âplaygroundâ has a higher ID.
So, maybe it´ll make sense to add an information to make sure that the file ~/homedir/user/.k3d/kubeconfig-⌠has the ownership 1000:0, as 1000 is the expected UID inside the container:
~/.k3d$ ll -n
total 12
drwxrwxr-x 2 1001 1001 4096 Okt 5 17:09 ./
drwxr-xr-x 5 1001 1001 4096 Okt 5 16:49 âŚ/
-rw------- 1 1000 0 3063 Okt 5 17:09 kubeconfig-gitops-playground.yaml
Here we goâŚ
$docker run -it -v ~/.k3d/kubeconfig-${CLUSTER_NAME}.yaml:/home/.kube/config --net=host ghcr.io/cloudogu/gitops-playground
Applying gitops playground to kubernetes cluster: âk3d-gitops-playgroundâ.
Continue? y/n [n]
y
Full log output is appended to /tmp/playground-log-XXXAhgene
[ok] Basic setup & configuring registryâŚ
âŚprogressingâŚ
As I see some further issues within Jenkins as well, I´ll using another docker run command up from here.
Therefore, please find some more lines regarding my experiences in âGitOps Playground: no jobs shown in Jenkinsâ in some minutes as well.
I found there the information how to keep the logs, so I didn´t start with --rm already, but will do the debug piece as well.
Cheers,
Sascha