- Take me to Practice Test
If you have an Apple M1 or M2 (Apple Silicon) machine, then please follow the separate instructions here.
-
Install the kubeadm, kubelet and kubectl packages at exact version 1.24.0 on the controlplane and node01.
Run the following two steps on both
controlplane
andnode01
(usessh node01
to get to the worker node).-
Configure kernel parameters
cat <<EOF | tee /etc/modules-load.d/k8s.conf br_netfilter EOF cat <<EOF | tee /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl --system
-
Install kubernetes binaries
apt-get update apt-get install -y apt-transport-https ca-certificates curl curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list apt-get update apt-get install -y kubelet=1.24.0-00 kubeadm=1.24.0-00 kubectl=1.24.0-00 apt-mark hold kubelet kubeadm kubectl
-
-
What is the version of kubelet installed?
kubelet --version
-
How many nodes are part of kubernetes cluster currently?
Are you able to run
kubectl get nodes
?Know that the kubeconfig file installed by kubeadm is located in
/etc/kubernetes/admin.conf
kubectl get nodes --kubeconfig /etc/kubernetes/admin.conf
0
-
Information only
-
Initialize controlplane node
-
Get the IP address of the
eth0
adapter of the controlplaneifconfig eth0
Take the value printed for
inet
in the output. This will be something like the following, but can be different each time you run the lab.10.13.26.9
-
Run
kubeadm init
using the IP address determined above for--apiserver-advertise-address
kubeadm init \ --apiserver-cert-extra-sans=controlplane \ --apiserver-advertise-address 10.13.26.9 \ --pod-network-cidr=10.244.0.0/16
-
Set up the default kubeconfig file
mkdir ~/.kube cp /etc/kubernetes/admin.conf ~/.kube/config
-
-
Generate a kubeadm join token
You can copy the join command output by
kubeadm init
which looks likekubeadm join 10.13.26.9:6443 --token cpwmot.ldhadf3cokvyyx60 \ --discovery-token-ca-cert-hash sha256:ea3a622922315b14b289c6efd7b1a77cbf81d29f6ddaf03472c304b6d3228c06
Note it will be different each time you do the lab.
-
Join node01 to the cluster using the join token
ssh
ontonode01
and paste the join command from above- Return to the controlplane node
- Run
kubectl get nodes
. Note that both nodes areNotReady
. This is OK because we have not yet installed networking.
-
Install a Network Plugin
-
Install flannel
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
-
Wait 30 seconds or so, then run
kubectl get nodes
. Nodes should now be ready.
-