Skip to content

Instantly share code, notes, and snippets.

@svennam92
Last active October 19, 2022 23:03
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 svennam92/fbc8750e87f1070bf15b88759672203b to your computer and use it in GitHub Desktop.
Save svennam92/fbc8750e87f1070bf15b88759672203b to your computer and use it in GitHub Desktop.
Kubernetes PSP (Pod Security Policy) Checker
# PSPs will be removed from Kubernetes in the 1.25 release
# Run this command to see which pods in your cluster are still associated with a PSP
kubectl get pod -A -o jsonpath='{range .items[?(@.metadata.annotations.kubernetes\.io/psp)]}{.metadata.name}{"\t"}{.metadata.annotations.kubernetes\.io/psp}{"\t"}{.metadata.namespace}{"\n"}'
# Example output (podname, psp name, namespace):
carts-dynamodb-cc5bf4649-8mp66 privileged carts
catalog-7c5d554d84-nzqph privileged catalog
checkout-66b6dcbc45-x7jj6 privileged checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment