Get variables of every deployment in cluster

4/19/2021

I'm trying to make a list of all deployments' variables in kubernetes cluster with kubectl command. I'm doing something like

kubectl get deploy --all-namespaces -o custom-columns='NAME:metadata.name,ENV:spec.template.spec.containers.env.name'

but something always go wrong. How should I write kubectl command to get table of deployments and their variables with values?

-- cusl
devops
kubectl
kubernetes

1 Answer

4/19/2021

Here is the right command:

kubectl get deploy --all-namespaces -o custom-columns='NAME:metadata.name,ENV:spec.template.spec.containers[*].env[*].name'
-- Yiadh TLIJANI
Source: StackOverflow