无法在谷歌容器引擎上部署kubernetes控制器

时间:2017-06-27 20:47:46

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

我的yaml文件:

kind: ReplicationController
apiVersion: v1
metadata:
  name: locust-master
  labels:
    name: locust
    role: master
spec:
  replicas: 1
  selector:
    name: locust
    role: master
  template:
    metadata:
      labels:
        name: locust
        role: master
    spec:
      containers:
        - name: locust
          image: gcr.io/MY_PROJECT/locust-tasks:latest
          env:
            - name: LOCUST_MODE
              key: LOCUST_MODE
              value: master
            - name: TARGET_HOST
              key: TARGET_HOST
              value: http://MY_WEBSITE.io
          ports:
            - name: loc-master-web
              containerPort: 8089
              protocol: TCP
            - name: loc-master-p1
              containerPort: 5557
              protocol: TCP
            - name: loc-master-p2
              containerPort: 5558
              protocol: TCP

正在运行kubectl create -f locust-master-controller.yaml 给出:

错误:错误验证" locust-master-controller.yaml":错误验证数据:[找到v1.EnvVar的无效字段键,找到v1.EnvVar的无效字段键];如果您选择忽略这些错误,请使用--validate = false

关闭验证

我基本上是逐字逐句地遵循说明: https://github.com/GoogleCloudPlatform/distributed-load-testing-using-kubernetes

1 个答案:

答案 0 :(得分:2)

只需删除这两行: Functional Interfaces key: LOCUST_MODE

key: TARGET_HOST 部分中没有名为key的密钥。完成documentation for env is here.