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.
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"
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 220.127.116.11 n2-standard-4 1.18.16-gke.302 2 RUNNING cluster1 us-central1-c 1.18.16-gke.302 18.104.22.168 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/v1beta1, apps/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.,
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:
- Google cloud shell command to get the default PROJECT_ID – GCP
- Docker EXPOSE Port only to the Host on Google Cloud
- Get Docker Container’s IP Address from the Host
- Copy Files between Host and Docker Container
- What is ImagePullBackOff status on a Kubernetes pod ?
- Set or change root password in Ubuntu Linux
- How to list all Containers running in Kubernetes Pod ?
- How to find which users belongs to a specific group in linux
- Give write permissions for specific user or group for specific folder in linux
- How to remove an image tag from docker hub ?
- Build a Docker Image with a Dockerfile and Cloud Build in GCP?
- How to create GCP project on Google Cloud Platform
- MariaDB – How to set max_connections permanently ?
- Create GCP project on Google Cloud Platform
- Is it possible to change Google Cloud Platform Project ID ?
- Create non-root SSH user account and provide access to specific folders
- Make manual payment or pay early for your Google Cloud Platform charges
- Open specific port such as 8082 in Google Compute Engine
- Delete or unset clusters contexts and users entries from kubectl config