Created
February 4, 2019 03:08
-
-
Save leitu/b8429ebc2fde771e87377afc0f377341 to your computer and use it in GitHub Desktop.
k8s tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List pods which has CONSUL_HOST | |
kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].env[?(@.name=="CONSUL_HOST")].value}{"\n"}{end}' | awk ' NF==2 {print $0} ' | |
# List deployment which has CONSUL_HOST | |
kubectl get deployment -o jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.spec.template.spec.containers[*].env[*].name}{'\n'}{end}" | grep "CONSUL_HOST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment