Kubernetes with Kubeadm

Distribution Overview

Installation Architectures

  • Single node cluster: You use one server to install the control plane and configure it to also accept workloads.
  • Single controller, multi worker: You configure one server as the single controller node of the cluster and add additional worker nodes that host the workloads. The minimum required hardware spec for the nodes is at least 2 CPU and 2GB RAM for controller nodes, and 1 CPU, 2GB RAM for worker nodes.
  • Multi controller, multi worker: This architecture adds additional controller nodes for a more robust cluster. The number of controller nodes should confirm to the equation of 2*n + 1 to allow a quorum in the case that a controller node goes down.

Installation Process

  • Install kubeadm, kubctl, and kubelet on each node
  • Configure the same cgroup driver that is used by the container runtime for these binaries as well
  • Check and define the required kubeadm CLI flags to be used (see all supported CLI flags), such as these:
  • dedicated control plane endpoint when multiple controller nodes are used
  • the CRI to be used
  • the network plugin configuration options to enable Pod networking
  • Run kubeadm init on the (primary) controller node
  • When this command is successful, it will print a status message, including the later to be used command kubeadm join
  • Check the supported CNI plugins
  • Download and install a plugin version that is compatible with your Kubernetes version
  • If the installation is successful, the CoreDNS pod will start
  • Get the join token by running kubeadm token list on the controller node
  • Use the kubeadm join command that was printed during setup of the first controller node
  • … on a new work node:
kubeadm join <control-plane-host>:<control-plane-port> \   --token <token> \   --discovery-token-ca-cert-hash sha256:<hash> \   --certificate-key <certificate-key>
  • … on a new controller node, additionally add the flag --control-plane
  • On controller nodes, configure the startup script to be the same as the above provisioned one.

Upgrade Process

  • Upgrade kubeadm
  • Manually install the new version of kubeadm via the OS package manager
  • Run kubeadm upgrade plan the following command to pre-plan the upgrade process
  • For the first controller node, run kubeadm upgrade apply v1.25.x to apply the updates
  • For all other controller nodes, run kubeadm upgrade node
  • Optionally: Upgrade the CNI
  • Remove all workloads from the controller node with kubectl drain <node-to-drain> --ignore-daemonsets
  • Manually install new versions of kubelet and kubectl via the OS package manager
  • Restart workload/scheduling workloads with kubectl uncordon <node-to-drain>
  • Manually install the new version of kubeadm via the OS package manager
  • Apply the update with kubeadm upgrade node
  • Remove all workloads from the node with kubectl drain <node-to-drain> --ignore-daemonsets
  • Manually install new versions of kubelet and kubectl via the OS package manager
  • Restart workload/scheduling workloads with kubectl uncordon <node-to-drain>

Customization

  • etcd
  • Containerd
  • CRI-O
  • Docker Engine (up to Kubernetes Version v1.24)

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store