我正在使用minikube,目前正在创建作为卷附加到Pod的配置映射 这是我的test-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2016-02-18T18:52:05Z
name: bb-configmap
namespace: default
resourceVersion: "516"
uid: b4952dc3-d670-11e5-8cd0-68f728db1985
data:
game.properties: |
enemies=aliens
enemies.cheat=true
lives=3
enemies.cheat.level=noGoodRotten
secret.code.passphrase=UUDDLRLRBABAS
secret.code.allowed=true
secret.code.lives=30
ui.properties: |
color.good=purple
color.bad=yellow
allow.textmode=true
how.nice.to.look=fairlyNice
我的pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: busybox-container
image: busybox
volumeMounts:
- name: config-dir
mountPath: /etc/config
volumes:
- name: config-dir
configMap:
name: bb-configmap
当我启动Pod时,它会继续重启并说crashloopbackoff。 据我了解,它应该处于完成状态,但处于crashLoopBackOff 请在下面找到描述广告连播的详细信息
Containers:
busybox-container:
Container ID: docker://bb650f7fe715855adb8ca8ab3be04e62924bcda2abfccff78e5e30cf20e2dc02
Image: busybox
Image ID: docker-pullable://busybox@sha256:4f47c01fa91355af2865ac10fef5bf6ec9c7f42ad2321377c21e844427972977
Port: <none>
Host Port: <none>
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Completed
Exit Code: 0
Started: Fri, 21 Aug 2020 17:23:20 +0530
Finished: Fri, 21 Aug 2020 17:23:20 +0530
Ready: False
Restart Count: 11
Environment: <none>
Mounts:
/etc/config from config-dir (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-zkt9s (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
config-dir:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: bb-configmap
Optional: false
default-token-zkt9s:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-zkt9s
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled <unknown> default-scheduler Successfully assigned default/mypod to minikube
Normal Pulling 35m (x4 over 36m) kubelet, minikube Pulling image "busybox"
Normal Pulled 34m (x4 over 36m) kubelet, minikube Successfully pulled image "busybox"
Normal Created 34m (x4 over 36m) kubelet, minikube Created container busybox-container
Normal Started 34m (x4 over 36m) kubelet, minikube Started container busybox-container
Warning BackOff 74s (x157 over 35m) kubelet, minikube Back-off restarting failed container
答案 0 :(得分:3)
在PodSpec中,restartPolicy
defaults to Always
。为了使Pod转到Completed
而不是CrashLoopBackOff
,应将此字段设置为OnFailure
。
默认行为是,除非另有说明,否则Kubernetes希望Pod始终处于运行状态。