Skip to content

Instantly share code, notes, and snippets.

@ipedrazas
Created February 7, 2020 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipedrazas/77cccdf41991e8a1149f569286654955 to your computer and use it in GitHub Desktop.
Save ipedrazas/77cccdf41991e8a1149f569286654955 to your computer and use it in GitHub Desktop.
List pods with secrets in volumes or envvars
kubectl get pods -n main -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{'\t'}Volumes:{'\t'}{.spec.volumes[*].secret.secretName}{'\n'}{'\t'}Envvars:{'\t'}{.spec.containers[*].env[*].valueFrom.secretKeyRef}{.name}{.key}{'\n'}{end}"

returns

gw-main-7b5789879-w85tz	2020-02-06T20:07:00Z
	Volumes:	gw-token-jrwgm istio.gateway
	Envvars:	map[key:client-id name:salesforce] map[key:redirect-url name:salesforce] map[key:public-url name:salesforce]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment