On a Digital Ocean Kubernetes Cluster I am trying to create a pod using a Docker image pulled from Docker Hub but it keeps failing with CrashLoopBackOff and restarting. The image is a Rails app in a docker container and is quite large. I suspect that Kubernetes is restarting the pod before the image can load.
Here are the errors:
kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE exactpos-deployment-864c768bff-zr86t 0/1 CrashLoopBackOff 10 27m 10.244.66.4 sleepy-nobel-3v8a nginx-deployment-7d69d57649-97w92 1/1 Running 0 40m 10.244.66.7 sleepy-nobel-3v8a
Events: Type Reason Age From Message
---- ------ ---- ---- ------- Normal Scheduled 27m default-scheduler Successfully assigned default/exactpos-deployment-864c768bff-zr86t to sleepy-nobel-3v8aNormal Pulled 26m (x4 over 27m) kubelet, sleepy-nobel-3v8a Successfully pulled image "index.docker.io/markhorrocks/exactpos_web:prod"
Normal Created 26m (x4 over 27m) kubelet, sleepy-nobel-3v8a Created container
Normal Started 26m (x4 over 27m) kubelet, sleepy-nobel-3v8a Started container
Normal Pulling 26m (x5 over 27m) kubelet, sleepy-nobel-3v8a pulling image "index.docker.io/markhorrocks/exactpos_web:prod"
Warning BackOff 2m (x117 over 27m) kubelet, sleepy-nobel-3v8a Back-off restarting failed container
Here is my yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: exactpos-deployment
spec:
replicas: 1
selector:
matchLabels:
app: exactpos-deployment
template:
metadata:
labels:
app: exactpos-deployment
spec:
containers:
- name: exactpos
image: index.docker.io/markhorrocks/exactpos_web:prod
imagePullPolicy: Always
command: [ "echo", "SUCCESS" ]
imagePullSecrets:
- name: dockerhub-cred
kubectl logs exactpos-deployment-864c768bff-zr86t
?