xetra11
xetra11

Reputation: 8885

Figure out where ConfigMap values are used in the cluster

In my team we have a single huge ConfigMap Resource that holds all the important variables distributed to all our pods.

After some time we realized that it is very hard to follow up where those variables are finally used. I was wondering if there is any way with Helm or kubectl to figure out where the values of the ConfigMap are actually used. Like a list of all the pods being supplied by the ConfigMap etc.

I researched for it but somehow it seems nobody is talking about that. Therefore I might understand the concept wrong here?

Am thankful for any guidance here.

Upvotes: 4

Views: 176

Answers (1)

Masudur Rahman
Masudur Rahman

Reputation: 1693

You cannot directly use kubectl field selectors to get the result. You can output all the pods in json and use jq to query from the output. For example, this query outputs name of all pods that uses configMap "kube-proxy" as volumes

$ kubectl get pods --all-namespaces -o json | jq '.items[] | select(.spec.volumes[].configMap.name=="kube-proxy")' | jq .metadata.name

Upvotes: 2

Related Questions