kubernetes gcp

no matches for kind “Deployment” in version “extensions/v1beta1”

This tutorial guides you on how to resolve error no matches for kind “Deployment” in version “extensions/v1beta1” while trying to deploy workloads using kubectl command in Google Cloud Platform GKE cluster.

no matches for kind “Deployment” in version “extensions/v1beta1”

I was trying to setup or install kafka docker on GKE kubernetes cluster. Kafka relies on Zookeeper to keep track of kafka’s configuration and topics details.

While I was trying to deploy Zookeeper using the following deployment YAML configuration.

zookeeper.yml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: zookeeper-deployment
spec:
  selector:
    matchLabels:
      app: zookeeper
  template:
    metadata:
      labels:
        app: zookeeper
    spec:
      containers:
      - name: zoo1
        image: digitalwonderland/zookeeper
        ports:
        - containerPort: 2181
        env:
        - name: ZOOKEEPER_ID
          value: "1"
        - name: ZOOKEEPER_SERVER
          value: zoo
---
apiVersion: v1
kind: Service
metadata:
  name: zoo
  labels:
    app: zookeeper
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  selector:
    app: zookeeper

The above deployment YAML creates a kubernetes deployment and schedule zookeeper pods and a kubernetes service to route the traffic to the Pods. But, I got the below error while trying to deploy using kubectl command.

$ kubectl apply -f zookeeper.yml -n mv
error: unable to recognize "zookeeper.yml": no matches for kind "Deployment" in version "extensions/v1beta1"

Troubleshooting

First, I quickly checked what is the master version or version of kubernetes cluster that I have created. The kubernetes version that I was using is GKE release channel 1.18.16-gke.302.

$ gcloud container clusters list

NAME      LOCATION       MASTER_VERSION   MASTER_IP      MACHINE_TYPE   NODE_VERSION     NUM_NODES  STATUS
cluster2  asia-east1-c   1.18.16-gke.302  34.80.233.207  n2-standard-4  1.18.16-gke.302  2          RUNNING
cluster1  us-central1-c  1.18.16-gke.302  34.70.148.99   n2-standard-4  1.18.16-gke.302  2          RUNNING

After that, I quickly checked the deprecated API’s that are removed. I got to know that Deployment in the extensions/v1beta1apps/v1beta1, and apps/v1beta2 API versions is no longer served from 1.16 version.

As the kubernetes API evolves, the APIs are periodically re-organized or upgraded.  Therefore, the old API is deprecated and eventually it will be removed. After, checking the link API Deprecations in 1.16 I came to know that, I need to migrate to use apps/v1 instead of extensions/v1beta1 as mentioned in the link.

- Deployment in the extensions/v1beta1, apps/v1beta1, and apps/v1beta2 API versions is no longer served
  -- Migrate to use the apps/v1 API version, available since v1.9. Existing persisted data can be retrieved/updated via the new version.
 

Therefore, it is very clear that you need to use apps/v1 API version instead of extensions/v1beta1 for the Deployment configuration in the YAML file. i.e.,

Use

apiVersion: apps/v1

Instead of

apiVersion: extensions/v1beta1

for the Deployment.

After making those changes, the error no matches for kind “Deployment” in version “extensions/v1beta1” gone away as shown below.

$ kubectl apply -f zookeeper.yml -n mv

deployment.apps/zookeeper-deployment created

That’s it. Hope it helped 🙂

You’ll also like:

References

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Brian
Brian
2 years ago

I was stuck with roughly the same exact issue and thankfully you saved me a lot of time not having to track that down myself.