How to set environment variables in CoreOS

8/3/2015

I need to set environment variable in kubernetes slave which is a coreos system. I have tried using exportand declare but it keeps reading each argument as a separate command

-- priyanka_rao
coreos
kubernetes

2 Answers

9/18/2015

don't set variables in the command field, take a look at the env field.

-- Tim Hockin
Source: StackOverflow

9/30/2015
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
-- MrE
Source: StackOverflow