kubernetes: Can't create pods from yaml template

With apiserver HEAD, creating pod from this yml template fails:

id: rqueue_test_cluster
apiVersion: v1beta1
kind: ReplicationController
desiredState:
  replicas: 1
  replicaSelector:
    name: rqueue_test
    env: dev
    test-machine: a1
  podTemplate:
    desiredState:
      manifest:
        version: v1beta1
        id: rqueue_test
        containers:
          - name: test
            image: b8.dev.g8teway.com/test
            imagePullPolicy: PullAlways
            env:
              - name: TEST_SERVICE_TARGET
                value: 11.111.1.111:11111
              - name: TEST_SERVICE_LISTEN_PORT
                value: 1234
              - name: TEST_SERVICE_NAME
                value: test-a1.dev.g8teway.com

    labels:
      name: rqueue_test
      env: dev
      test-machine: a1
[joss@~/projects/kubernetes_cluster/kubernetes/rqueue-test]$ kubectl --server="https://b7.dev.g8teway.com:6443" create -f rqueue-test-a1.yml
F1205 11:37:09.060948   21864 create.go:59] error unmarshaling JSON: json: cannot unmarshal number into Go value of type string

[root@b7 ~]# kube-apiserver -version=true
Kubernetes v0.6.0-94-g39bf3d2950e394-dirty

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

This is still an issue and should be resolved by the Kubernetes team. I cannot specify environment variables with integer values. Integer values are perfectly valid YAML and JSON, so the issue is Kubernetes. I should not have to quote integer values in a YAML file.

What’s worse is the inconsistency. This seems to work for port values, replicas, etc, but still not in environment variables.

This should be allowed as it is perfectly valid YAML AND JSON (when converted):

        env:
        - name: MONGO_PORT
          value: 27017

Yet, apply complains:

unable to decode "deployment_example.yaml": [pos 413]: json: expect char '"' but got char '2'

A basic bug, four years in the running, still not fixed in 1.6+. Any word on when this will be fixed?

Then either: A) API is broken. Fix it to accept non string values. B) What’s sending to the API is broken and should simply quote all value values in the env array.