Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubectl wait for one pod of a statefulset to be READY?

To wait for a certain pod to be completed the command is

kubectl wait --for=condition=Ready pod/pod-name

Similarly I want to wait for any one pod in the statefulset to be ready. I tried the command below which did not work,

kubectl wait --for=condition=Ready statefulset/statefulset-name

What should the command options look like?

like image 686
agirlwithnoname Avatar asked Mar 16 '20 03:03

agirlwithnoname


People also ask

How do you use kubectl wait?

Use Wait command We utilize the 'wait' command to recess until the pods meet the requirements. Use kubectl apply to relate the variations to the cluster and wait a randomly set amount of time (60 seconds) to check the status of the pod. At this point, we expect the fresh deployment to be active and the old one removed.

How do I restart StatefulSet in Kubernetes?

In one terminal, watch the StatefulSet's Pods. In a second terminal, use kubectl delete to delete all the Pods in the StatefulSet. Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready. Use kubectl exec and kubectl run to view the Pods hostnames and in-cluster DNS entries.

How do you know when pods are ready?

If the output from a specific pod is desired, run the command kubectl describe pod pod_name --namespace kube-system . The Status field should be "Running" - any other status will indicate issues with the environment. In the Conditions section, the Ready field should indicate "True".

What is serviceName in StatefulSet?

serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string. serviceName. default.


Video Answer


1 Answers

I used following and it works for me

kubectl wait -l statefulset.kubernetes.io/pod-name=activemq-0 --for=condition=ready pod --timeout=-1s
like image 96
ImranRazaKhan Avatar answered Sep 18 '22 10:09

ImranRazaKhan