copy PODIP in configmap during kubernetes deployment

12/26/2019

I need to pass "PODIP" env value to configmap for configuration during k8s deployment

deploy.yaml

- env:
  - name: PODIP
    valueFrom:
      fieldRef:
        fieldPath: status.podIP

how to do this? 10x

-- Maurice Amar
configmap
environment-variables
kubernetes

1 Answer

12/30/2019

I did small research on topic and it come out that a configmap was intentionally made ReadOnly some time ago.

If you really need interacting with files from a configmap then you could instead put the files in a writeable volume and mount the volume. Or you could to use the centralized configuration like consul.

Addtionally, you can try storing values in a database. Another option to store configuration information could be a distributed cache such as redis or hazelcast, etc.

That is Pull request which made ConfigMaps ReadOnly.

Hope that helps. Let me know if that was the info you've been looking for :)

-- Nick
Source: StackOverflow