一键式Pod有两种状态代码,可从API或命令运行:kubectl run --restart=Never --image test:v0.1 ...
。
pods 将输出文件生成到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
不返回任何内容,因为容器仅生成输出文件。提前致谢!
最佳答案
ExitCode 0
表示它正常终止
如果通过管道传输到另一个进程,则可以使用退出代码,因此该进程知道下一步该怎么做(如果上一个进程失败,请执行其他操作,否则对传递的数据进行某些操作...)