Skip to content

Instantly share code, notes, and snippets.

@yohanb
Created January 22, 2024 19:49
Show Gist options
  • Save yohanb/f85fae0878f14949042d94dff2699e0a to your computer and use it in GitHub Desktop.
Save yohanb/f85fae0878f14949042d94dff2699e0a to your computer and use it in GitHub Desktop.
gets workloads that have istio proxy sidecar
#!/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