Chapter 2. Creating a Kubernetes Cluster
In this chapter we discuss multiple ways to set up a full-blown Kubernetes cluster. We cover low-level, standardized tooling (kubeadm) that also serves as the basis for other installers and show you where to find the relevant binaries for the control plane, as well as for worker nodes. We discuss a containerized Kubernetes setup with hyperkube, demonstrate how to write systemd unit files to supervise Kubernetes components, and finally show how to set up clusters in Google Cloud and on Azure.
2.1 Installing kubeadm to Create a Kubernetes Cluster
Problem
You want to use kubeadm to bootstrap a Kubernetes cluster from scratch.
Solution
Download the kubeadm CLI tool from the Kubernetes package repository.
You will need kubeadm installed on all the servers that will be part of your Kubernetes cluster—not only the master, but also all the nodes.
For example, if you are using Ubuntu-based hosts, on each host do the following as root to set up the Kubernetes package repository:
# apt-get update && apt-get install -y apt-transport-https # curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - # cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main EOF # apt-get update
Now you can install the Docker engine and the various Kubernetes tools. You will need the following:
-
The
kubeletbinary -
The
kubeadmCLI -
The
kubectlclient -
kubernetes-cni, the Container Networking Interface ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access