List of all environment variables for a Pod

2019-09-05 04:56发布

问题:

I have a web app on OpenShift v3 (all-in-One), using the Wildfly Builder Image. In addition, I created a service named xyz, to point to an external host+IP. Something like this:

        "kind": "Service",
        "apiVersion": "v1",
        "metadata": { "name": "xyz" },
        "spec": {
            "ports": [
                {   "port": 61616,
                    "protocol": "TCP",
                    "targetPort": 61616
                }
            ],
            "selector": {}
        }

I also have an endpoint, pointing externally, but that is not relevant for this question.

When deployed, my program can access an environment variable named XYZ_PORT=tcp://172.30.192.186:61616

However, I cannot figure out how to see all the values of all such variables either via the web-console, or using the CLI. Using the web-console, I cannot see it being injected into the YAML.

I tried some of the oc env options, but none seem to list what I want.

回答1:

Let's say you are deploying kitchensink, then the below CLI should list all the environment variables:

oc env bc/kitchensink --list