Rebooting A Pod Or Vm In Kubernetes: Deletion, Scaling Down, And Using Virtctl

Kubernetes
Pod
VM
Reboot
Virtctl
State
Deployment
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.
Published

July 24, 2024


k8s reboot pod and vm

to reboot you need to kill the pod/vmi and recreate it, thereby all its states will be lost.

kubectl delete pod <pod_name>
kubectl delete vmi <vmi_name>

for vmi there is an option called soft-reboot which is absent in pods. however the vm runner pod must not exit.

virtctl soft-reboot <vmi_name>

for pod you you can scale down the replicas of deployment (recommended), or kill the pod directly.

kubectl scale deployment <deployment_name> --replicas=0
kubectl scale deployment <deployment_name> --replicas=<original replica num>

for vm you are supposed to use virtctl

virtctl start <vm_name>
virtctl stop <vm_name>
virtctl restart <vm_name>