Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

error: unable to recognize "deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1" #2126

Open
longfei-zhang opened this issue Oct 9, 2019 · 4 comments

Comments

@longfei-zhang
Copy link

longfei-zhang commented Oct 9, 2019

I have installed minikube then try to install etcd operator but got following error:

[root@longfei-cd-test example]# kubectl create -f deployment.yaml 
error: unable to recognize "deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"

here is my kubectl version info:

[root@longfei-cd-test etcd-operator]# kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
@longfei-zhang longfei-zhang changed the title error: unable to recognize "example/deployment.yaml": no matches for kind "Deployment" in version "extensions/v1" error: unable to recognize "deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1" Oct 9, 2019
@longfei-zhang
Copy link
Author

oh I see

https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/

DaemonSet, Deployment, StatefulSet, and ReplicaSet (in the extensions/v1beta1 and apps/v1beta2 API groups)
Migrate to use the apps/v1 API, available since v1.9. Existing persisted data can be retrieved/updated via the apps/v1 API.

@longfei-zhang
Copy link
Author

longfei-zhang commented Oct 9, 2019

Now changed the deployment.yaml to the following, it's working fine.

[root@longfei-cd-test example]# cat deployment.yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: etcd-operator
spec:
  selector:
    matchLabels:
      app: etcd-operator
  replicas: 1
  template:
    metadata:
      labels:
        app: etcd-operator
    spec:
      containers:
      - name: etcd-operator
        image: quay.io/coreos/etcd-operator:v0.9.4
        command:
        - etcd-operator
        # Uncomment to act for resources in all namespaces. More information in doc/user/clusterwide.md
        #- -cluster-wide
        env:
        - name: MY_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name

@longfei-zhang
Copy link
Author

Here are my PR
#2127

@huzhou520
Copy link

---
+ apiVersion: apps/v1
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: ambassador
spec:
  replicas: 3
+   selector:
+     matchLabels:
+       service: ambassador
  template:
...

fly2nadeem added a commit to fly2nadeem/kubernetes-katas that referenced this issue Dec 31, 2019
Getting Error when try to use the YAML file. As per the below link by changing the  "apiVersion: apps/v1" has resolve the issue.
Hence changed "apiVersion: extensions/v1beta1" to "apiVersion: apps/v1" in the YAML file

coreos/etcd-operator#2126

Error : - 

PS C:\Users\Samu\.kube> kubectl apply -f "C:\Users\Samu\.kube\nginx-simple-deployment.yaml"
error: unable to recognize "C:\\Users\\Samu\\.kube\\nginx-simple-deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"

PS C:\Users\Samu\.kube> kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.8", GitCommit:"211047e9a1922595eaa3a1127ed365e9299a6c23", GitTreeState:"clean", BuildDate:"2019-10-15T12:11:03Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
brandonslee pushed a commit to brandonslee/kubernetes-ci-cd that referenced this issue Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants