为什么pods返回Error或ExitCode:0即使它们成功运行?

时间:2016-01-22 01:45:11

标签: docker kubernetes nfs

从API或命令运行的一次性pod的两种状态代码:

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

pod将输出文件生成到NFS服务器,并且我已成功获取文件。

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

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

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

他们的NFS卷:

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不返回任何内容,因为容器只生成输出文件。

提前致谢!

1 个答案:

答案 0 :(得分:0)

ExitCode 0表示正常终止

如果您管道到另一个进程,可以使用退出代码,因此进程知道下一步要做什么(如果上一个进程失败,请执行此操作,否则对传递的数据执行某些操作...)