如何在 CoreOS 中设置环境变量

How to set environment variables in CoreOS

我需要在coreos系统的kubernetes slave中设置环境变量。 我试过使用 exportdeclare 但它一直将每个参数作为单独的命令读取

不要在command字段中设置变量,查看env字段。

apiVersion: v1
kind: ReplicationController
metadata:
  labels:
    name: api
  name: api
spec:
  replicas: 1
  selector:
    name: api
  template:
    metadata:
      labels:
        name: api
    spec:
      containers:
      - env:
        - name: VARIABLE       <---- declare an env variable NAME
          value: "value-of-variable"   <--- here is the value
        - name: ANOTHER_VARIABLE
          value: "another-value"
        image: myregistry/api
        imagePullPolicy: Always
        name: api