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

ghz 1years ago ⋅ 861 views

Question

I am trying to check the status of a pod using kubectl wait command through this [documentation](https://kubernetes.io/docs/reference/generated/kubectl/kubectl- commands#wait). 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](https://github.com/msraju2009/kubernetes-tests/blob/master/kubernetes- json-output.json).

Can someone help me to fix the issue


Answer

This totally looks like you are running kubectl wait --for=condition=complete on a [Pod](https://github.com/msraju2009/kubernetes- tests/blob/master/kubernetes-json-output.json) as described in your output rather than a [Job](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to- completion/).

A pod doesn't have the --for=condition=complete option. Exactly, what I get when I run it on a pod:

$ kubectl wait --for=condition=complete pod/mypod-xxxxxxxxxx-xxxxx
error: .status.conditions accessor error: Failure is of the type string, expected map[string]interface{}