Kubernetes poweruser tips
Table of Contents
Further tips will follow!Fetch revisions for a
Source
Fetch revisions for a StatefulSet
#
Revisions for StatefulSet
& DaemonSet
are stored in ControllerRevision
objects.
kubectl get controllerrevisions --all-namespaces
These revisions allow rolling back StatefulSet
by running
kubectl rollout undo
Different from Deployment
which capture the state in ReplicaSet
kudos Sheogorath
Get events for a certain Pod #
kubectl get events --field-selector involvedObject.name=<pod-name>
Get events for other objects #
kubectl get events --field-selector involvedObject.kind=<resource-name>,involvedObject.name=<object-name>
- resource-name could be
Pod
,Job
,CronJob
etc. - object-name the name of resource
Delete a PVC stuck in “Terminating” state #
You’ve probably already tried to forcefully delete the PVC
kubectl delete pvc <pvc-name> --force --grace-period=0
PVC needs to be unmounted from the node in order to finalize deletion and we do that by annotating the object with the removal of finalizer field.
kubectl patch pvc <pvc-name> -p '{"metadata":{"finalizers":null}}'
Also kudos Dean Lewis