Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Created November 9, 2023 03:43
Show Gist options
  • Save zulhfreelancer/d38d5e7e48288a80c95f04394abed2a3 to your computer and use it in GitHub Desktop.
Save zulhfreelancer/d38d5e7e48288a80c95f04394abed2a3 to your computer and use it in GitHub Desktop.
List all Kubernetes nodes by a specific taint(s)
# Search by key
kubectl get nodes -o json | jq -r '.items[] | select(.spec.taints[]? | select(.key == "foo/bar")) | .metadata.name'
# Search by key and value
kubectl get nodes -o json | jq -r '.items[] | select(.spec.taints[]? | select(.key=="foo/bar" and .value=="baz")) | .metadata.name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment