skip to Main Content

I have created a image "docker4nitin/tg_bot:v2" and pushed into the dockerhub. I have created a k8 deployment file to deploy it but it is failing to pull the image.
This is deployment.yml file

deployment.yml file
Please fix this issue. I’m literally tired of finding the solution but did not find any.

I want to deploy it in K8

2

Answers


  1. Everything is fine with your image. I just tested it by creating following deployment and kubernetes pulls it fine.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: test-deployment
    spec:
      selector:
        matchLabels:
          app: test
      replicas: 1 # tells deployment to run 2 pods matching the template
      template:
        metadata:
          labels:
            app: test
        spec:
          containers:
          - name: tgbot
            image: docker4nitin/tg_bot:v2
            ports:
            - containerPort: 80
    

    Here are the events that occurred when I pulled it on my end.

    Events:
      Type     Reason     Age                   From                   Message
      ----     ------     ----                  ----                   -------
      Normal   Scheduled  4m1s                  bin-packing-scheduler  Successfully assigned default/test-deployment-6bf6bbbfb5-mlrgp to ip-10-250-0-97.eu-central-1.compute.internal
      Normal   Pulling    4m1s                  kubelet                Pulling image "docker4nitin/tg_bot:v2"
      Normal   Pulled     3m43s                 kubelet                Successfully pulled image "docker4nitin/tg_bot:v2" in 17.153014569s
      Normal   Created    2m8s (x5 over 3m42s)  kubelet                Created container tgbot
      Normal   Started    2m8s (x5 over 3m41s)  kubelet                Started container tgbot
      Normal   Pulled     2m8s (x4 over 3m40s)  kubelet                Container image "docker4nitin/tg_bot:v2" already present on machine
      Warning  BackOff    2m7s (x9 over 3m39s)  kubelet                Back-off restarting failed container
    

    if you pay attention, image pull works fine but there’s something wrong with your container itself that is causing the backoff of the container. Maybe posting the specific error here is more useful.

    Login or Signup to reply.
  2. You can run the below manually and try your deployment

    docker pull docker4nitin/tg_bot:v2
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search