Search code examples
pythonbashautomationopenshiftdevops

Changing environment variables from inside of pod to openshift


I want to change a environment variable of openshift from inside a pod.

The thing I want to change is Bearer token, as that will get expired within a day or so, and changing it manually is not possible on n numbers of environment. So I want to change the value of the environment variable using a script inside the pod.

I am stuck and want some guidance regarding this. Any help will be appreciated.


Solution

  • You can use an oc or curl command inside the container to do this. Ofcource your container image has to contain the oc or curl command. If your value is stored in a secret see, How to update Secrets (Without Deleting and Creating) in Openshift?

    See https://docs.openshift.com/container-platform/4.10/authentication/ldap-syncing.html. It describes how to run an oc command within a container.