Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubectl wait --for=condition=complete --timeout=30s

I am trying to check the status of a pod using kubectl wait command through this documentation. Following is the command that i am trying

kubectl wait --for=condition=complete --timeout=30s -n d1 job/test-job1-oo-9j9kj 

Following is the error that i am getting

Kubectl error: status.conditions accessor error: Failure is of the type string, expected map[string]interface{} 

and my kubectl -o json output can be accessed via this github link.

Can someone help me to fix the issue

like image 541
Auto-learner Avatar asked Nov 29 '18 10:11

Auto-learner


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.

What is kubectl dry run?

Kubectl apply dry-run does the necessary work by producing the outcome of the apply merge deprived of actually maintaining it. Perhaps we upgrade flag help, issue a notice if Dry-run is used when appraising items using Apply, document Dry-run's limits, and use server dry-run.

What is kubectl rollout restart?

Rolling Restart MethodKubernetes now allows you to execute a rolling restart of your deployment as of version 1.15. This is the quickest restart mechanism in Kubernetes, as it is a new addition. The command given above shuts down and restarts each container in your deployment one by one.

What does kubectl expose command do?

kubectl expose − This is used to expose the Kubernetes objects such as pod, replication controller, and service as a new Kubernetes service. This has the capability to expose it via a running container or from a yaml file.


1 Answers

To wait until your pod is running, check for "condition=ready". In addition, prefer to filter by label, rather than specifying pod id. For example:

$ kubectl wait --for=condition=ready pod -l app=netshoot  pod/netshoot-58785d5fc7-xt6fg condition met 

Another option is rollout status - To wait until the deployment is done:

$ kubectl rollout status deployment netshoot deployment "netshoot" successfully rolled out 

Both options works great in automation scripts, when it is required to wait for an app to be installed. However, as @CallMeLaNN noted for the second option, deployment "rolled out" is not necessarily without errors.

like image 183
Noam Manos Avatar answered Sep 22 '22 06:09

Noam Manos