coreos / etcd-operator

etcd operator creates/configures/manages etcd clusters atop Kubernetes
https://coreos.com/blog/introducing-the-etcd-operator.html
Apache License 2.0
1.75k stars 741 forks source link

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

Open longfei-zhang opened 4 years ago

longfei-zhang commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Here are my PR https://github.com/coreos/etcd-operator/pull/2127

huzhou520 commented 4 years ago

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