Solution to pod error “back off restarting failed container”
Phenomenon:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 3m default-scheduler Successfully assigned default/jenkins-master-deploy-6694c4f497-r46fn to master.localdomain
Normal SandboxChanged 85s kubelet, master.localdomain Pod sandbox changed, it will be killed and re-created.
Normal Pulled 83s (x5 over 2m59s) kubelet, master.localdomain Container image "drud/jenkins-master:v0.29.0" already present on machine
Normal Created 83s (x5 over 2m59s) kubelet, master.localdomain Created container jenkins-master
Normal Started 81s (x5 over 2m59s) kubelet, master.localdomain Started container jenkins-master
Warning BackOff 78s (x9 over 2m57s) kubelet, master.localdomain Back-off restarting failed container
Solution.
Add the command to the end of the deployment affirmation image
command: [ “/bin/bash”, “-ce”, “tail -f /dev/null” ]
kind: Deployment
apiVersion: apps/v1beta2
metadata:
labels:
app: jenkins-master
name: jenkins-master-deploy
spec:
replicas: 1
selector:
matchLabels:
app: jenkins-master
template:
metadata:
labels:
app: jenkins-master
spec:
containers:
- name: jenkins-master
image: drud/jenkins-master:v0.29.0
imagePullPolicy: IfNotPresent
command: [ "/bin/bash", "-ce", "tail -f /dev/null" ]
volumeMounts:
- mountPath: /var/jenkins_home/
name: masterjkshome
ports:
- containerPort: 8080
volumes:
- name: masterjkshome
persistentVolumeClaim:
claimName: pvcjkshome
Similar Posts:
- K8S Error: no metrics known for node [How to Solve]
- [Solved] k8s Deploy postgresql Error: initdb: error: directory “/var/lib/postgresql/data” exists but is not empty
- [Solved] Docker/k8s use Arthas to generate flame diagram Error: Perf events unavailable. See stderr of the target process.
- [Solved] Jenkins deploy task error: Host key verification failed
- The newly deployed k8s cluster of the virtual machine reports an error when executing kubectl logs and exec
- Git Error: fatal: Not a valid object name: ‘master’.
- Obstacle Elimination set: Slave_ IO_ R unning:No And slave_ IO_ R unning:Connecting reason
- docker: Error response from daemon: Conflict. The container name “/xx” is already in use
- Setting up CocoaPods master repo [How to Fix Stuck Issue]