Step 1: Configure Container Runtime Forwarding Rules
Before installing the Kubernetes components, configure the necessary system forwarding rules on both nodes. Run the following command on both the control plane and node1:The output might also recommend installing a specific version of the Kubernetes packages. Keep this in mind as you progress through the installation.
Step 2: Install kubeadm, kubelet, and kubectl
Follow the steps below to install the Kubernetes components on both the control plane and node1. These instructions are based on Ubuntu; adjust as necessary for your distribution.1. Update the Package Repository and Install Prerequisites
2. Add the Google Cloud Public Signing Key
If your Ubuntu release (e.g., Ubuntu 22.04) does not have the/etc/apt/keyrings directory, create it first:
3. Set Up the Kubernetes apt Repository
4. Update the Package List and Install Components
Step 3: Verify Your Distribution
Before continuing, confirm that you’re using the correct distribution. Run:Step 4: Addressing GPG Key and Repository Setup Errors
Sometimes an error may occur similar to:If you encounter the error above, first create the required directory:sudo mkdir -p /etc/apt/keyringsThen re-run the curl command to download the key. Once the key is successfully downloaded, proceed with updating the package lists and installation:
Step 5: Verify the kubelet Version
After installation, confirm the kubelet version with:Step 6: Bootstrap the Kubernetes Cluster
Since the cluster is not yet initialized, attempting to list nodes will generate errors. On the control plane, run:Identify the Control Plane IP Address
Before initializing, check the IP address of your control plane’s primary interface (for example, eth0):Initialize the Cluster
Using the control plane’s IP (e.g., 192.7.220.6), initialize the cluster with a specified pod network CIDR:Step 7: Generate and Use the kubeadm Join Token
After initialization, a join token is provided in the kubeadm output. You can choose to generate a new token or use the one provided.On Node1, Configure the kubeconfig
Join the Cluster on Node1
Replace the IP address, token, and hash with those provided in your kubeadm init output:Verify the Cluster Nodes
On the control plane, check if node1 has joined the cluster:Step 8: Install a Network Plugin
For pods to communicate across nodes, you must install a network plugin. The kubeadm output provides a list of available network add-ons. In this lesson, we will install Flannel. On the control plane, run:Summary
With these steps completed, you have successfully accomplished the following:- Configured the system forwarding rules.
- Installed the necessary Kubernetes components (v1.26.0).
- Bootstrapped the control plane.
- Joined a worker node (node1) to the cluster.
- Deployed the Flannel network plugin for pod networking.