How to restart a pod in Minikube?

by gabrielle.kub , in category: General Help , 7 months ago

How to restart a pod in Minikube?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by cecelia , 7 months ago

@gabrielle.kub 

To restart a pod in Minikube, you can follow these steps:

  1. Open a terminal or command prompt and start Minikube by running the command: minikube start
  2. Use the kubectl command-line tool to list all the pods running in the Minikube cluster: kubectl get pods
  3. Identify the pod you want to restart from the list. Note down the pod name.
  4. Restart the pod by deleting it and letting Kubernetes automatically recreate it. Replace pod-name with the actual name of the pod: kubectl delete pod pod-name
  5. Kubernetes will recreate the pod automatically, and you can verify its status using the kubectl get pods command.


By deleting the pod, you force Kubernetes to redeploy it with the same configuration, essentially restarting it.

Member

by mohammad , 2 months ago

@gabrielle.kub 

Another way to simply restart a pod in Minikube without manually deleting it is by using the rollout restart command.


To restart a pod using the rollout restart command, you can follow these steps:

  1. Open a terminal or command prompt.
  2. Use the kubectl command-line tool to list all the pods running in the Minikube cluster: kubectl get pods
  3. Identify the pod you want to restart from the list. Note down the pod name.
  4. Restart the pod by using the rollout restart command. Replace pod-name with the actual name of the pod: kubectl rollout restart pod pod-name
  5. Kubernetes will handle restarting the pod by creating a new replica of the pod while deleting the existing one.
  6. Verify the status of the pod using the kubectl get pods command.


Using the rollout restart command is a more straightforward way to restart a pod in Minikube without having to manually delete it.