Why the pods returns Error or ExitCode:0 even they run successfully?

1/22/2016

There's two kinds of status code of one-shot pods, running from API or the command:

kubectl run --restart=Never --image test:v0.1 ....

The pods produce output files to a NFS server, and I've got files successfully.

kubectl get pods -ao wide:

NAME       READY     STATUS       RESTARTS   AGE       
test-90    0/1       ExitCode:0   0          23m       192.168.1.43
test-91    0/1       ExitCode:0   0          23m       192.168.1.43
test-92    0/1       ExitCode:0   0          23m       192.168.1.43
test-93    0/1       ExitCode:0   0          23m       192.168.1.43
test-94    0/1       Error        0          23m       192.168.1.46
test-95    0/1       Error        0          23m       192.168.1.46
test-96    0/1       Error        0          23m       192.168.1.46
test-97    0/1       Error        0          23m       192.168.1.46
test-98    0/1       Error        0          23m       192.168.1.46
test-99    0/1       ExitCode:0   0          23m       192.168.1.43

the description of ExitCode:0 pod:

Name:                           test-99
Namespace:                      default
Image(s):                       test:v0.1
Node:                           192.168.1.43/192.168.1.43
Status:                         Succeeded
Replication Controllers:        <none>
Containers:
  test:
    State:              Terminated
      Exit Code:        0
    Ready:              False
    Restart Count:      0

the description of Error pod:

Name:                           test-98
Namespace:                      default
Image(s):                       test:v0.1
Node:                           192.168.1.46/192.168.1.46
Status:                         Succeeded
Replication Controllers:        <none>
Containers:
  test:
    State:              Terminated
      Reason:           Error
      Exit Code:        0
    Ready:              False
    Restart Count:      0

Their NFS volumes:

Volumes:
  input:
    Type:       NFS (an NFS mount that lasts the lifetime of a pod)
    Server:     192.168.1.46
    Path:       /srv/nfs4/input
    ReadOnly:   false
  output:
    Type:       NFS (an NFS mount that lasts the lifetime of a pod)
    Server:     192.168.1.46
    Path:       /srv/nfs4/output
    ReadOnly:   false
  default-token-nmviv:
    Type:       Secret (a secret that should populate this volume)
    SecretName: default-token-nmviv

kubectl logs returns none, since the container just produces output files.

Thanks in advance!

-- Yang
docker
kubernetes
nfs

1 Answer

1/22/2016

ExitCode 0 means it terminated normally

Exit codes can be used if you pipe to another process, so the process knows what to do next (if previous process failed do this, else do something with the data passed...)

-- MrE
Source: StackOverflow