Figure out where ConfigMap values are used in the cluster

10/23/2019

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.

-- xetra11
configmap
kubernetes
kubernetes-helm

1 Answer

10/23/2019

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
-- Masudur Rahman
Source: StackOverflow