我需要在kubernetes slave中设置环境变量,这是一个coreos系统。
我尝试过使用export
和declare
,但它会将每个参数作为单独的命令
答案 0 :(得分:1)
不要在command
字段中设置变量,请查看env
字段。
答案 1 :(得分:1)
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