Let us take a look at the Docker images used for nodes
The ubuntu based images "petschenek/ubuntu-systemd:master-arc-21.10 (compressed size 220MB) and petschenek/ubuntu-systemd:worker-arc-21.10 (compressed size 230MB)" have systemd installed in them. You can check the Dockerfile for master-amd64 and Dockerfile for worker-amd64
In these Dockerfiles there are three important points:
- We need to tell systemd that it is in Docker.
ENV container=docker
- We need to declare the stopsignal different than the default stopsignal of Docker which is SIGTERM whereas systemd exits on SIGRTMIN+3.
STOPSIGNAL SIGRTMIN+3
- We need to declare a volume for
/var/lib/containerd
in worker node image because the filesystem of pods that will be created in the cluster must be a normal filesystem. When you run Docker in Docker, the outer Docker runs on top of a normal filesystem (EXT4, BTRFS etc), but the inner Docker runs on top of a copy-on-write system (AUFS, BTRFS etc). Since you cannot run AUFS on top of AUFS, you need to useVOLUME ["/var/lib/containerd"]
in the Dockerfile or specify-v /var/lib/containerd
during container creation.
-
DOCKER
-
KUBECTL
-
HELM
Must be installed on your host
Download the scripts:
git clone --depth=1 https://github.com/ManasPecenek/clinco.git && cd clinco && export KUBECONFIG=./admin.kubeconfig && alias startCluster="bash $PWD/initial-script.sh" addNode="bash $PWD/add-worker.sh"
Now run the script with how many worker nodes you want. For example "startCluster -n 3" will result in a 3-worker-node cluster:
startCluster -n <worker-node-count>
If you do not specify worker node count, it will be "1" by default.
docker ps
kubectl cluster-info
Note: If you cannot connect to the cluster by default, just run "export KUBECONFIG=./admin.kubeconfig" in the same directory.
kubectl get nodes -o wide
-
kubectl apply -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper/release-3.7/deploy/gatekeeper.yaml
-
kubectl get pods -o wide -n gatekeeper-system
If you want to add additional worker nodes, all you need to do is run addNode -n <number>
. For example addNode -n 2
will add two additional nodes into your cluster. If you do not specify a number and run only addNode
, it will add only 1 node to your cluster.