I tried creating a deployment with minikube cluster connected to virtual box.But it results with below mentioned Imagepullbackoff error(Passed commands on Windows powershell-admin rights)
I tried with docker as a driver but same result.Help me out!!
PS C:Windowssystem32>kubectl get pod
NAME READY STATUS RESTARTS AGE
mongo-express-98c6ff4b4-l7jmn 0/1 ImagePullBackOff 0 116m
mongodb-deployment-67dcfb9c9f-mfvxr 0/1 ImagePullBackOff 0 116m
PS C:Windowssystem32> kubectl describe pod
Name: mongo-express-98c6ff4b4-l7jmn
Namespace: default
Priority: 0
Node: minikube/192.168.59.113
Start Time: Thu, 30 Jun 2022 19:10:41 +0530
Labels: app=mongo-express
pod-template-hash=98c6ff4b4
Annotations: <none>
Status: Pending
IP: 172.17.0.4
IPs:
IP: 172.17.0.4
Controlled By: ReplicaSet/mongo-express-98c6ff4b4
Containers:
mongo-express:
Container ID:
Image: mongo-express
Image ID:
Port: 8081/TCP
Host Port: 0/TCP
State: Waiting
Reason: ImagePullBackOff
Ready: False
Restart Count: 0
Environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: <set to the key 'mongo-root-username' in secret 'mongodb-secret'> Optional: false
ME_CONFIG_MONGODB_ADMINPASSWORD: <set to the key 'mongo-root-password' in secret 'mongodb-secret'> Optional: false
ME_CONFIG_MONGODB_SERVER: <set to the key 'database_url' of config map 'mongodb-configmap'> Optional: false
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lp9nk (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-lp9nk:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 60m default-scheduler Successfully assigned default/mongo-express-98c6ff4b4-l7jmn to minikube
Warning Failed 58m (x6 over 59m) kubelet Error: ImagePullBackOff
Normal Pulling 58m (x4 over 59m) kubelet Pulling image "mongo-express"
Warning Failed 58m (x4 over 59m) kubelet Failed to pull image "mongo-express": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
Warning Failed 58m (x4 over 59m) kubelet Error: ErrImagePull
Warning Failed 29m (x2 over 36m) kubelet Failed to pull image "mongo-express": rpc error: code = Unknown desc = context deadline exceeded
Normal BackOff 19m (x141 over 59m) kubelet Back-off pulling image "mongo-express"
Name: mongodb-deployment-67dcfb9c9f-mfvxr
Namespace: default
Priority: 0
Node: minikube/192.168.59.113
Start Time: Thu, 30 Jun 2022 19:10:32 +0530
Labels: app=mongodb
pod-template-hash=67dcfb9c9f
Annotations: <none>
Status: Pending
IP: 172.17.0.3
IPs:
IP: 172.17.0.3
Controlled By: ReplicaSet/mongodb-deployment-67dcfb9c9f
Containers:
mongodb:
Container ID:
Image: mongo
Image ID:
Port: 27017/TCP
Host Port: 0/TCP
State: Waiting
Reason: ImagePullBackOff
Ready: False
Restart Count: 0
Environment:
MONGO_INITDB_ROOT_USERNAME: <set to the key 'mongo-root-username' in secret 'mongodb-secret'> Optional: false
MONGO_INITDB_ROOT_PASSWORD: <set to the key 'mongo-root-password' in secret 'mongodb-secret'> Optional: false
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ft77v (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-ft77v:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 60m default-scheduler Successfully assigned default/mongodb-deployment-67dcfb9c9f-mfvxr to minikube
Warning Failed 58m (x6 over 60m) kubelet Error: ImagePullBackOff
Normal Pulling 58m (x4 over 60m) kubelet Pulling image "mongo"
Warning Failed 58m (x4 over 60m) kubelet Failed to pull image "mongo": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
Warning Failed 58m (x4 over 60m) kubelet Error: ErrImagePull
Warning Failed 34m kubelet Failed to pull image "mongo": rpc error: code = Unknown desc = context deadline exceeded
Normal BackOff 19m (x134 over 60m) kubelet Back-off pulling image "mongo"
3
Answers
Try to pull image first, then create deployment.
UPD: Sometimes even
image pull
doesn’t help. minikube developers said that you can curl to check whether you can connect to repo or not. There also may be ISP issues. Temporary changing my ISP to mobile data and installing needed pods worked for me.The error
context deadline exceeded
means that minikube was unable to pull mongo-express image with the expected time frame.You can fix this by directly pulling your image using the below command before creating your deployment.
I got inspiration from elver answer and this github discussion .
Indeed, it is because the image you want to pull is too large and the default time setting to pull an image is shorter. Thus, you should pull this image to your local first by below example command then recreate your deployment: