Reputation: 282
I am working with minikube , currently creating config-maps attaching as volume to the pod this is my 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
my 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
when I start my pod it is keep on restarting saying crashloopbackoff. As per my understanding it should be in completed state ,but it is in crashLoopBackOff please find the describe pod details below
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
Upvotes: 0
Views: 645
Reputation: 1112
In the PodSpec, restartPolicy
defaults to Always
. For the Pod to go to Completed
instead of CrashLoopBackOff
, this field should be set to OnFailure
.
The default behaviour is that Kubernetes expects a Pod to always be running, unless otherwise specified.
Upvotes: 3