Specify an `int` value in Kubernetes ConfigMap?

后端 未结 2 1296
南方客
南方客 2021-01-24 07:11

Is there a way to specify int values in ConfigMap? When I try to specify a port number I get the following error.

error: error validating \"my-deplo         


        
2条回答
  •  别那么骄傲
    2021-01-24 07:43

    I was facing a similar issue with setting port number as env variables. I have two services where ServiceB should connect to ServiceA. The error was

    /opt/service/config.yml has an error: * Incorrect type of value at: serviceAPort; is of type: String, expected: Integer My config.yml contains something like this - serviceAPort: "${SERVICEA_PORT!'9091'}"

    Kubernetes was creating an environment variable SERVICEA_PORT in a format which had Protocol:IP:port. This could not be parsed to an int by ServiceB

    I realised this upon using the 'printenv' in ServiceB pod and overrode it with the following config

    env:
      - name : SERVICEA_PORT
        value: 9091
    

    Basically, it was a conflict because of env variables created by k8s out of the box.

提交回复
热议问题