Home > Mobile >  Can not pull the Mongo image in Kubernetes
Can not pull the Mongo image in Kubernetes

Time:09-05

'''

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongodb-deployment
  labels: 
    app: mongodb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongodb
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      containers:
      - name: mongodb
        image: mongo
        ports:
        - containerPort: 27017
        env: 
        - name: MONGO_INITDB_ROOT_USERNAME
          valueFrom:
            secretKeyRef:
              name: mongodb-secret
              key: mongo-root-username
        - name: MONGO_INITDB_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mongodb-secret
              key: mongo-root-password

'''

I have tried several times to apply Kubernetes pod with this Yaml file but don't understand the problem. It is always showing the error.

'''
Failed to pull image "mongo": rpc error: code = Unknown desc = context deadline exceeded
  Warning  Failed     13s    kubelet            Error: ErrImagePull
  Normal   BackOff    13s    kubelet            Back-off pulling image "mongo"
  Warning  Failed     13s    kubelet            Error: ImagePullBackOff
'''

If anyone can help. I am stuck here for several days.

CodePudding user response:

instead of "mongo" for the image use this: "registry.hub.docker.com/library/mongo"

CodePudding user response:

You are missing the image tag. use mongo:latest

  • Related