我写了一个 Kubernetes 部署清单:
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
当尝试将其提交到我的集群时,我收到以下错误:
$ kubectl create -f deployment.yaml
error: unable to recognize "deployment.yaml": no matches for /, Kind=Deployment
环境
$ 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"}