Skip to content

Instantly share code, notes, and snippets.

@umutbasal
Created January 8, 2023 22:13
Show Gist options
  • Select an option

  • Save umutbasal/8444b5e33090395b1fcaf61b8a09700d to your computer and use it in GitHub Desktop.

Select an option

Save umutbasal/8444b5e33090395b1fcaf61b8a09700d to your computer and use it in GitHub Desktop.
kubectl get pods -A -o json | jq -r '.items[] | "\(.metadata.name) \(.metadata.namespace) \(.spec.containers[]?.ports[]?.containerPort)"' | awk '{print $1"."$2".svc.cluster.local:"$3}' | grep -v null
kubectl get svc -A -o json | jq -r '.items[] | "\(.metadata.name) \(.metadata.namespace) \(.spec.ports[]?.port)"' | awk '{print $1"."$2".svc.cluster.local:"$3}' | grep -v null
kubectl get endpoints -A -o json | jq -r '.items[] | "\(.metadata.name) \(.metadata.namespace) \(.subsets[]?.ports[]?.port)"' | awk '{print $1"."$2".svc.cluster.local:"$3}' | grep -v null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment