0

I wrote a Kubernetes Deployment manifest:

apiVersion: v1
kind: Deployment
metadata:
  name: test-persistence
spec:
  selector:
    matchLabels:
      name: test-persistence
  template:
    metadata:
      labels:
        name: test-persistence
      name: test-persistence
    spec:
      containers:
        - name: test-persistence
          image: ubuntu
          command: ["tail", "-f", "/dev/null"]
          volumeMounts:
            - mountPath: /test-persistence
              name: test-persistence
      volumes:
        - name: test-persistence
          persistentVolumeClaim:
            claimName: test-persistence

When trying to submit it to my cluster, here is the error I get:

$ kubectl create -f deployment.yaml
error: unable to recognize "deployment.yaml": no matches for /, Kind=Deployment

Environment

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.4", GitCommit:"bee2d1505c4fe820744d26d41ecd3fdd4a3d6546", GitTreeState:"clean", BuildDate:"2018-03-12T16:29:47Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9+", GitVersion:"v1.9.7-gke.6", GitCommit:"9b635efce81582e1da13b35a7aa539c0ccb32987", GitTreeState:"clean", BuildDate:"2018-08-16T21:33:47Z", GoVersion:"go1.9.3b4", Compiler:"gc", Platform:"linux/amd64"}
2

Answering my own question

Following the documentation example, I replaced

apiVersion: v1

by

apiVersion: apps/v1

and it worked just fine afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.