Install the Network Plugin
To enable pod networking, you need to install a CNI plugin.
For this, we will use the Calico Tigera Operator.
Step 1: Install the Tigera Operator and Custom Resources
Execute the following commands to install the operator and CRD's.
This command installs the Tigera operator and its custom resources in the cluster.
The Tigera operator is responsible for managing the installation and lifecycle of Calico, which is a CNI (Container Network Interface) plugin used for pod networking and network policies.
Step 2: Download the Calico Custom Resource
Use the following command to download the calico custom resource.
This will download the custom-resources.yaml file to your local machine, but it won't apply it to the cluster.
So why do you need to download and edit the custom resource for pod networking?
Because the custom resource defines how Calico should be configured in your cluster.
In our case we need to adjust the IP pools to match our Pod network settings that we used in the Kubeadm config.
Step 3: Get the cluster CIDR range
To get theĀ cluster CIDR range, run the following command.
You should getĀ 10.244.0.0/16Ā as the output because that value was used in theĀ kubeadm.configĀ during cluster initialization.
Step 4: Customize custom-resources.yaml
Open the custom-resources.yaml file and change the default CIDR from 192.168.0.0/16 to 10.244.0.0/16, which is the value specified in your kubeadm configuration. You should also see this same value in the previous output.
Verifying the CIDR ensures that the pod network is correctly configured for your cluster.
Open the custom-resources.yaml
Find the section with cidr: 192.168.0.0/16 and replace it with cidr: 10.244.0.0/16.
Hereās how the updated section should look after replacing cidr: 192.168.0.0/16 with cidr: 10.244.0.0/16.
Step 5: Deploy the custom resource
After updating the custom-resources.yaml file with the correct pod CIDR, apply it to the cluster to complete the Calico setup.
Run the following command:
Now, when you check the pod status, you should see all the pods, including Calico and CoreDNS, in a Running state as shown below:
It may take a few minutes for all the pods to reach the running state.
Also, if you check the node status, you will see that all the nodes are now in a Ready state.
Before installing the CNI, the nodes were in a NotReady state.
Run the following command to verify:
0 comments