Google Kubernetes Engine:运行状况检查错误

时间:2018-03-12 23:30:16

标签: kubernetes google-cloud-platform google-kubernetes-engine

尝试上传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

请帮忙! :)

1 个答案:

答案 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),另一个用于包含的广告连接。