Kubernetes: creating pod with specific environments

3/2/2016

I tried to create a pod with a particular environment for uwsgi configuration , but it was this message :
failed to load "phptime.yml": JSON: I can not unpack the number in the value of the string type Go when I tried to run this command :
kubectl create -f phptime.yml
I found that trouble in environments that has names like this:
UWSGI_HTTP-MODIFIER1
or
UWSGI_PHP-SAPI-NAME

or
UWSGI_MASTER-AS-ROOT
but with environments that has a next names all ok:
UWSGI_HTTP
or
UWSGI_INCLUDE
A lot of our containers took configuration from environments and I need include all of my conf environments. This is my rc conf:

  containers:
  - name: phptime
    image: ownregistry/phpweb:0.5
    env:
    - name: UWSGI_UID
      value: go
    - name: UWSGI_GID
      value: go
    - name: UWSGI_INCLUDE
      value: /var/lib/go-agent/pipelines/test/test-dev0/.uwsgi_dev.ini
    - name: UWSGI_PHP-SAPI-NAME
      value: apache
    - name: UWSGI_HTTP
      value: :8086
    - name: UWSGI_HTTP-MODIFIER1
      value: 14
    - name: UWSGI_PIDFILE
      value: '/tmp/uwsgi.pid'
    - name: UWSGI_MASTER-FIFO
      value: '/tmp/fifo0'
    - name: UWSGI_MASTER-AS-ROOT
      value: 'true'
    - name: UWSGI_MASTER
      value: 'true'
    ports:
    - containerPort: 8086
    resources:
      limits:
        cpu: 500m
        memory: 200Mi
      requests:
        cpu: 500m
        memory: 200Mi
    volumeMounts:
    - mountPath: /var/lib/go-agent/pipelines/test/test-dev0/
      name: site
      readOnly: true
  volumes:
  - hostPath:
      path: /home/user/www/
    name: site

Is this kubernetes issue or it`s my? How to solve this? Thanks!

-- Rodion Sabodash
docker
kubernetes

1 Answer

3/2/2016

You must quote all of the values that you want to set as environment variables that the yaml parser might interpret as a non-string type.

For example, in influxdb-grafana-controller.yaml the values true and false are quoted because they could be interpreted as booleans. The same constraint applies to purely numerical values.

-- Robert Bailey
Source: StackOverflow