volumeClaimTemplates And Other Uneditable SectionsvolumeClaimTemplates entry).kubectl delete statefulset STATEFULSET_NAME --cascade=orphan--cascade=orphan flag, it stops the ControllerRevisions objects (+ the Pods) to not be deleted (no downtime).kubectl rollout restart statefulset STATEFULSET_NAME command.Example for StatefulSet and Deployment below:
kubectl rollout restart statefulset STATEFULSET_NAME
kubectl rollout restart deployment DEPLOYMENT_NAME
kubectl patch -n kube-system ds kube-proxy -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"$(date +'%s')\"}}}}}"
Running kubectl replace/kubectl apply on an object which the command above was used on, will always trigger a rolling update again. This is due to the change to the annotations.
The Pods manifest assumes that you are allowed to run privileged Pods in your cluster.
If you are using you may need to set a ServiceAccount which is allowed "all the things" (e.g. privileged, hostNetwork, and so on).
kind: Pod
apiVersion: v1
metadata:
name: debug-pod
labels:
app: debug
spec:
hostNetwork: true
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
- key: "CriticalAddonsOnly"
operator: "Exists"
restartPolicy: Never
hostIPC: true
hostPID: true
# nodeName: SPECIFIC_TARGET_NODE
priorityClassName: "system-cluster-critical"
containers:
- name: debug-pod
image: busybox
command: ["/bin/sleep", "36000"]
securityContext:
privileged: true
allowPrivilegeEscalation: true
kubectl exec -it POD_NAME -- sh into the Pod and use nsenter to escape the container's namespace:
$ nsenter -t 1 -m -u -n -i sh
The node-role.kubernetes.io/ can take "anything" as a role.
Meaning that node-role.kubernetes.io/my-cool-role (any value) will cause the kubectl get nodes output to display my-cool-role (and other such role labels) as the Node role.
kubectl config set-context --current --namespace NAMESPACE
kubectl config use-context CONTEXT_NAME
kubectl config get-contexts
kubectl create job --from=cronjob/CRONJOB_NAME JOB_NAME
kubectl create job --from=cronjob/curator curator-manual-run