Skip to content

Kubectl Cheat Sheet

Secrets

# Get a secret and decode it immediately
kubectl get secret my-secret -o jsonpath='{.data.password}' | base64 --decode

Finalizers

# Patch out finalizers to force delete a namespace or resource
kubectl patch ns/terminating-namespace -p '{"metadata":{"finalizers":[]}}' --type=merge

Resources

# Find all pods with a specific label
kubectl get pods -l app=frontend --all-namespaces