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
as always ⦠someones need it, the other ones donĀ“t like it and the last ones hate itā¦
.