Created
January 22, 2024 19:49
-
-
Save yohanb/f85fae0878f14949042d94dff2699e0a to your computer and use it in GitHub Desktop.
gets workloads that have istio proxy sidecar
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
#!/bin/bash | |
# 1. get all pod containers with istio proxy sidecars | |
# 2. get pod app labels (some have app, others have app.kubernetes.io/name) | |
# 3. return only uniques and not nulls | |
version=1.19.0 | |
kubectl get pods -A -o json | \ | |
jq "[.items[] | select(.spec.containers[].image | contains(\"istio/proxyv2:$version\"))]" | \ | |
jq '[.[].metadata.labels.app, .[].metadata.labels."app.kubernetes.io/name"]' | \ | |
jq 'unique | .[] | select( . != null)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment