尝试上传health-check.yaml
文件时收到以下错误:
error: error validating "health-check.yaml": error validating data: [ValidationError(Deployment.spec): unknown field "containers" in io.k8s.api.extensions.v1beta1.DeploymentSpec, ValidationError(Deployment.spec): missing required field "template" in io.k8s.api.extensions.v1beta1.DeploymentSpec]; if you choose to ignore these errors, turn validation off with --validate=false
health-check.yaml
:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
containers:
- name: nginx
livenessProbe:
httpGet:
path: /
port: 80
请帮忙! :)
答案 0 :(得分:1)
Containers
应在spec
- >下指定template
- > spec
。 e.g:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ...
spec:
selector:
matchLabels:
...
template:
spec:
containers:
- command: ...
image: ...
name: ...
livenessProbe:
httpGet:
path: /live
此处有2个规格,一个用于部署(因为您使用的是kind: Deployment
),另一个用于包含的广告连接。