ide
ide

Reputation: 20788

How can I debug why my single-job pod ends with status = "Error"?

I'm setting up a Kubernetes cluster and am testing a small container. This is my YAML file for the pod:

apiVersion: v1
kind: Pod
metadata:
  name: example
spec:
  restartPolicy: Never
  containers:
  - name: node
    image: 'node:5'
    command: ['node']
    args: ['-e', 'console.log(1234)']

I deploy it with kubectl create -f example.yml and sure enough it runs as expected:

$ kubectl logs example
1234

However, the pod's status is "Error":

$ kubectl get po example
NAME           READY     STATUS    RESTARTS   AGE
example        0/1       Error     0          16m

How can I investigate why the status is "Error"?

Upvotes: 8

Views: 13923

Answers (1)

MrE
MrE

Reputation: 20768

kubectl describe pod example will give you more info on what's going on

also

kubectl get events can get you more details too although not dedicated to the given pod.

Upvotes: 12

Related Questions