Rebooting A Pod Or Vm In Kubernetes: Deletion, Scaling Down, And Using Virtctl
In Kubernetes, to reboot a pod or VM, you can either delete and recreate it to lose state or scale down the deployment’s replicas for a soft-reboot. Additionally, you can use virtctl
to manage VMs.
k8s reboot pod and vm
to reboot you need to kill the pod/vmi and recreate it, thereby all its states will be lost.
1 | kubectl delete pod <pod_name> |
for vmi there is an option called soft-reboot
which is absent in pods. however the vm runner pod must not exit.
1 | virtctl soft-reboot <vmi_name> |
for pod you you can scale down the replicas of deployment (recommended), or kill the pod directly.
1 | kubectl scale deployment <deployment_name> --replicas=0 |
for vm you are supposed to use virtctl
1 | virtctl start <vm_name> |