Calico CNI on Kubernetes 1.21+

So I decided to go back and build a simple small “native” Kubernetes cluster on my #HomeLab network. I’m using my NFS server as my Cluster Master node. I created another 2 nodes using Ubuntu 20.04. I looked into using VMware’s NSX Container Plugin as my CNI provider. However, the configuration process was a little more intense than I was able to focus on right now. Here is a summary of my configuration:

  • OS (all nodes): Ubuntu 20.04.2 LTS
  • Kubernetes (kubeadm, kubelet, kubectl, kubernetes-cni): 1.21.0
  • Docker CE: 20.10.6
  • Calico: 3.17.4

I decided to go with another CNI provider that I have used previously: Calico. Since the Pod CIDR specified in my cluster init call was, I didn’t have to make any changes to the Calico YAML script. However, when I applied the calico configuration, I received this warning:

Warning: policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
poddisruptionbudget.policy/calico-kube-controllers created

As shown in the warning, the Kubernetes project has moved the PodDisruptionBudget element from their Beta API to the policy/v1 API. As a result, they have deprecated the former API call starting in v1.21 and will be unavailable from v1.25 onwards.

I submitted an Issue to the Calico Project, but in the meantime, here is a fix if you are running the current 1.21 release. After you download the Calico YAML using the following:

$ curl -O

Open the calico.yaml file and edit line 3850 (or thereabout). The original section looks like this:

apiVersion: policy/v1beta1
kind: PodDisruptionBudget
  name: calico-kube-controllers

Modify the apiVersion line to the following:

apiVersion: policy/v1

Save the file and apply the configuration to your cluster. You shouldn’t get any warnings on your deployment.

Let me know if you have any suggestions or comments. Have fun!

Leave a Reply

%d bloggers like this: