No matches for kind DaemonSet error while deploying flannel on Kubernetes

Shares

I was playing with the latest version of Kubernetes deployment on Ubuntu today. To have it fully functional Kubernetes cluster, you need to deploy a networking overlay on top. I choose to deploy flannel. When I was trying to deploy flannel, I got an error: no matches for kind DaemonSet in version extensions/v1beta1. See full message below.

Unable to recognize "https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml": no matches for kind "DaemonSet" in version "extensions/v1beta1"

I did start poking around the internet and I did find a post on StackOverflow with a similar issue. It turned out DaemonSet, Deployment, StatefulSet, and ReplicaSet resources will no longer be served from extensions/v1beta1, apps/v1beta1, or apps/v1beta2 by default in v1.16 or later. As I was using the latest stable k8s version, I had to modify the YML file manually to make it working with my deployment.
You need to change the apiVersion section of the YML file

apiVersion: extensions/v1beta1 -> apiVersion: apps/v1

Then, there is another error

missing required field "selector" in io.k8s.api.apps.v1.DaemonSetSpec;

I have to add selector filed into kube-flannel.yml

spec:
   selector:
     matchLabels:
      tier: node
      app: flannel

Make sure you add selector section in all DaemonSet sections of yml file

apiVersion: apps/v1
 kind: DaemonSet
 metadata:
   name: kube-flannel-ds-amd64
   namespace: kube-system
   labels:
     tier: node
     app: flannel
 spec:
   selector:
     matchLabels:
      tier: node
      app: flannel
   template:
     metadata:
       labels:
         tier: node
         app: flannel

When you update yml file, you can use kubectl to deploy flannel

cloud_user@ip-10-0-1-101:~$ kubectl apply -f /home/cloud_user/kube-flannel.yml 
 clusterrole.rbac.authorization.k8s.io/flannel unchanged
 clusterrolebinding.rbac.authorization.k8s.io/flannel unchanged
 serviceaccount/flannel unchanged
 configmap/kube-flannel-cfg unchanged
 daemonset.apps/kube-flannel-ds-amd64 created
 daemonset.apps/kube-flannel-ds-arm64 created
 daemonset.apps/kube-flannel-ds-arm created
 daemonset.apps/kube-flannel-ds-ppc64le created
 daemonset.apps/kube-flannel-ds-s390x created
 cloud_user@ip-10-0-1-101:~$

Check if nodes are in READY state:

cloud_user@ip-10-0-1-101:~$ kubectl get nodes
 NAME            STATUS   ROLES                  AGE   VERSION
 ip-10-0-1-101   Ready    control-plane,master   59m   v1.20.2
 ip-10-0-1-102   Ready                     53m   v1.20.2
 ip-10-0-1-103   Ready                     54m   v1.20.2
 cloud_user@ip-10-0-1-101:~$
5 1 vote
Article Rating

Artur Krzywdzinski

Artur is Consulting Architect at Nutanix. He has been using, designing and deploying VMware based solutions since 2005 and Microsoft since 2012. He specialize in designing and implementing private and hybrid cloud solution based on VMware and Microsoft software stacks, datacenter migrations and transformation, disaster avoidance. Artur holds VMware Certified Design Expert certification (VCDX #077).

You may also like...

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x

FOR FREE. Download Nutanix port diagrams

Join our mailing list to receive an email with instructions on how to download 19 port diagrams in MS Visio format.

NOTE: if you do not get an email within 1h, check your SPAM filters

You have Successfully Subscribed!

Pin It on Pinterest