# # This script is intended to be run on an Ubuntu 20.04, # 2cpu, 8G node. The course is **not** tested using containerd, # so you may have endless issues, or not. Only for those already # comfortable with Kubernetes, who want to compare and contrast # various container engines # By Tim Serewicz, 03/2022 GPL # Note there is a lot of software downloaded, which may require # some troubleshooting if any of the sites updates their code, # which should be expected. # These first several steps can be done on cp and worker. # Ensure two modules are loaded after reboot cat <> /etc/apt/sources.list.d/kubernetes.list" # Add the GPG key for the new repo sudo sh -c "curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -" # Install the Kubernetes packages - Using older version of k8s # so we can upgrade to current in future lab. Stop after these steps # if on the worker sudo apt-get update sudo apt-get install -y kubeadm=1.22.1-00 kubelet=1.22.1-00 kubectl=1.22.1-00 sudo apt-mark hold kubelet kubeadm kubectl # Create a cluster using containerd - Using older version of k8s # so we can upgrade to current in future lab. Only run init on # the control plane (cp) - **not** the worker. sudo kubeadm init --kubernetes-version 1.22.1 --cri-socket=/var/run/containerd/containerd.sock --pod-network-cidr 192.168.0.0/16 | tee $HOME/cp.out mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config # We'll use Calico for the network plugin kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml # Make sure all the infrastructure pods are running kubectl get pod --all-namespaces kubectl describe pod -l component=kube-apiserver -n kube-system kubectl get events # Enable command line completion source <(kubectl completion bash) echo "source <(kubectl completion bash)" >> $HOME/.bashrc # Untaint the control plane, as we only have one node kubectl taint node --all node-role.kubernetes.io/master- # Troubleshooting and or optional add ons # Get containerd running, append or create several files. cat <