The rest of succeeding sections is focused on on-premise implementation of Kubernetes.
If you prefer to use cloud platforms such as AWS to run Kubernetes, you may jump to the Kubernetes in the Cloud section.
There are multiple ways to setup a kubernetes cluster.
- A local cluster (on your machine)
- A production cluster on the cloud
- A on-prem, cloud-agnostic cluster
- A managed production cluster on AWS using EKS
There are available tools to automate bootstrapping clusters on on-premise and public cloud platforms.
For production-grade cluster:
- kubeadm
- Kubespray
- Kops
- K3s
For development-grade cluster (testing):
- minikube
- k3d
k3s is a lightweight version of kubernetes that can be installed using one binary.
- operational 1-node cluster
- instals kubectl - CLI tool
Here are some ways to run Kubernetes on your local machine.
- Minikube
- Docker Desktop
- kind
- kubeadm
Before we start running Kubernetes, we must review some considerations.
Where to install?
-
Cloud Kubernetes is a cloud-native tool and we could leverage the available services from cloud platforms.
- Using virtual machines (IaaS)
- Using managed service (PaaS)
-
On-prem
- Bare metal
- VirtuaL machines
Which one should we choose?
- it all depends on the strategy of the organization
- depends on the skillset and expertise of people in the organization
We've decided where to run Kubernetes, what's next?
- Cluster Networking
- Scalability
- High Availability
- Disaster Recovery
Checkout these resources to learn more about installation considerations:
After installing the Kubernetes packages, the next steps are:
- Create the cluster (specifically the master node)
- Disable the swap space on the nodes.
- Configure Pod networking
- Join additional nodes to our cluster
Before we can provision a cluster, we must ensure that the control plane and data plane is up and running, which is known as bootstraping the cluster.
This can be done manually but there's a risk for misconfiguration since we would need to run independent components separately.
We'll use kubeadm to create our cluster. The phases include:
- We'll run
kubeadm init
. - kubeadm does pre-flight checks which ensure the appropraite permissions and system resources are in place.
- kubeadm creates a certificate authority for authentication and encryption.
- kubeadm generates kubeconfig files for authenticating the components against the API server.
- kubeadm generates Static Pod Manifests which are monitored by the kubelet.
- kubeadm starts up the control plane.
- kubeadm taints the master, ensuring pods are only scheduled on worker nodes.
- kubeadm generates a Bootstrap Token for joining nodes to the cluster.
- kubeadm starts Add-on Pods: DNS and kube-proxy
Note that the process defined above can be customized by specifying parameters.