Multiple Ways To Restart Pods In Kubernetes [How To]

Tutorial to restart pods in Kubernetes.

Pods are the smallest deployable units in Kubernetes. A pod is a group of one or more containers. You need to have kubectl tool installed along with the minikube cluster at first.

Multiple Ways To Restart Pods In Kubernetes [How To]

At first, Run the minikube cluster by using the following command.

minikube start

Now list out the available pods with the following command.

 kubectl get pods

Now, you need to create a deployment and before that build a configuration file for deployment with the following command. The file will be created in your home directory.

touch deployment.YAML

Now create the deployment by the following kubectl command.

kubectl create –f deployment.yaml

Method 1: Restart Pods

Run the following command to restart the pod.

kubectl rollout restart deployment deployment_name

Method 2

Run the following command to restart the pod. In this method, you can force the pod to restart with the modifications made by setting or changing an environment variable

kubectl set env  deployment deployment-name DEPLOY_DATE "< $(date) "
READ More Relevant Stuff:  How To Install Python Anaconda On Ubuntu 18.04 LTS [Updated]

Leave a Reply

Your email address will not be published. Required fields are marked *