# Deployment

**URL:** <https://discuss.kubernetes.io/t/deployment/7103>\
**Category:** General Discussions\
**Created:** [July 10, 2019, 12:15pm UTC](https://discuss.kubernetes.io/t/deployment/7103 "2019-07-10T12:15:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 10, 2019, 12:15pm UTC](https://discuss.kubernetes.io/t/deployment/7103/1 "2019-07-10T12:15:58Z")

</div>

Hello,

I am getting the following error when deploying services on kubernetes master  
–ImagePullBackOff  
–Crashloopbackoff

I am able to deploy only one docker image on Kubernetes master i.e nginx but starts to get the above error when I try to deploy other services.

Kindly help me with this error. Thanks in Advance!

---

<div class="post-metadata">

**Author:** ![macintoshprime](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/macintoshprime/32/7121_2.png) [@macintoshprime](https://discuss.kubernetes.io/u/macintoshprime)\
**Post date:** [July 10, 2019, 12:29pm UTC](https://discuss.kubernetes.io/t/deployment/7103/2 "2019-07-10T12:29:31Z")

</div>

Are you able to take a look at the kubelet logs? There may be more clues in there as to what is going on.

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [July 10, 2019, 9:33pm UTC](https://discuss.kubernetes.io/t/deployment/7103/3 "2019-07-10T21:33:54Z")

</div>

It seems very unlikely to be related to deploying new services.

Can you check pods logs and output of kubernetes describe?

---

<div class="post-metadata">

**Author:** ![lampnick](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/lampnick/32/3306_2.png) [@lampnick](https://discuss.kubernetes.io/u/lampnick)\
**Post date:** [July 11, 2019, 2:14am UTC](https://discuss.kubernetes.io/t/deployment/7103/4 "2019-07-11T02:14:27Z")

</div>

1.kubectl get pod -n “your namespace” -o wide -\>to get scheduled node.  
2.connect to the node ,use docker pull to pull the image you want.If still can’t pull the image,that you docker have some problem.like network problem.

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 12, 2019, 7:17am UTC](https://discuss.kubernetes.io/t/deployment/7103/5 "2019-07-12T07:17:04Z")

</div>

Thanks for your reply!. Will surely look at the kubelet logs.

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 12, 2019, 10:58am UTC](https://discuss.kubernetes.io/t/deployment/7103/6 "2019-07-12T10:58:57Z")

</div>

I used the following command to get the logs of a pod on which CrashLoopBackOff error occurred.  
kubectl -n kube-system describe pod app-ubuntu-7f68b59b46-6824b

Following came in the event logs:-

Events:  
Type Reason Age From Message

* * *

Normal Scheduled 4m29s default-scheduler Successfully assigned kube-system/app-ubuntu-7f68b59b46-6824b to knode  
Normal Created 2m59s (x4 over 4m12s) kubelet, knode Created container app-ubuntu  
Normal Started 2m59s (x4 over 4m12s) kubelet, knode Started container app-ubuntu  
Warning BackOff 2m28s (x7 over 3m59s) kubelet, knode Back-off restarting failed container  
Normal Pulling 2m13s (x5 over 4m26s) kubelet, knode Pulling image “ubuntu”  
Normal Pulled 2m7s (x5 over 4m13s) kubelet, knode Successfully pulled image “ubuntu”

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 12, 2019, 11:00am UTC](https://discuss.kubernetes.io/t/deployment/7103/7 "2019-07-12T11:00:22Z")

</div>

All I found in the above event log was the message - Back-off restarting failed container.  
But there is no further details as to why it happened.

I deployed nginx image in the similar way but no issue occurred.

---

<div class="post-metadata">

**Author:** ![macintoshprime](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/macintoshprime/32/7121_2.png) [@macintoshprime](https://discuss.kubernetes.io/u/macintoshprime)\
**Post date:** [July 12, 2019, 12:14pm UTC](https://discuss.kubernetes.io/t/deployment/7103/8 "2019-07-12T12:14:54Z")

</div>

What command is the Ubuntu container running?

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [July 12, 2019, 1:59pm UTC](https://discuss.kubernetes.io/t/deployment/7103/9 "2019-07-12T13:59:16Z")

</div>

You don’t see logs from the pod itself when doing kubectl logs ?

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 15, 2019, 8:08am UTC](https://discuss.kubernetes.io/t/deployment/7103/10 "2019-07-15T08:08:00Z")

</div>

Yes, when I ran the following command to get the logs of the pod on which CrashLoopBackOff occurred :-  
kubectl -n kubernetes-dashboard logs app-ubuntu3-55f4898cb6-j9zwz  
where namespace: kubernetes dashboard  
pod name : app-ubuntu3-55f4898cb6-j9zwz

I didnt get anything in the logs. Even I tried to save the output of the above command in the file but the file comes out to be empty.

Is the above command correct?  
Is there any other command to check the logs of a pod?

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 15, 2019, 9:37am UTC](https://discuss.kubernetes.io/t/deployment/7103/11 "2019-07-15T09:37:46Z")

</div>

Hi,

What exactly are you asking?

---

<div class="post-metadata">

**Author:** ![macintoshprime](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/macintoshprime/32/7121_2.png) [@macintoshprime](https://discuss.kubernetes.io/u/macintoshprime)\
**Post date:** [July 15, 2019, 12:23pm UTC](https://discuss.kubernetes.io/t/deployment/7103/12 "2019-07-15T12:23:51Z")

</div>

Just wondering what that Ubuntu container supposed to be doing, launching nginx, apache or bash? If that command is failing is might explain why it’s going into a crashbackloop and not producing any logs. If you can provide the pod spec that would be great as well.

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 16, 2019, 6:06am UTC](https://discuss.kubernetes.io/t/deployment/7103/13 "2019-07-16T06:06:10Z")

</div>

I was trying to do a small deployment test. So I have chosen to deploy the two docker images - nginx and ubuntu separately. Nginx image was deployed successfully with no issues. But an issue occurred (CrashLoopBackOff ) when I tried to deploy ubuntu image.

Below is the output of the following command:-  
kubectl -n kubernetes-dashboard describe pod app-ubuntu3-55f4898cb6-j9zwz  
where  
kubernetes-dashboard is the namespace  
app-ubuntu3-55f4898cb6-j9zwz is the pod name

OUTPUT:-

Name: app-ubuntu3-55f4898cb6-j9zwz  
Namespace: kubernetes-dashboard  
Priority: 0  
PriorityClassName:   
Node: knode/172.20.10.5  
Start Time: Mon, 15 Jul 2019 12:21:05 +0530  
Labels: k8s-app=app-ubuntu3  
pod-template-hash=55f4898cb6  
Annotations: [cni.projectcalico.org/podIP:](http://cni.projectcalico.org/podIP:) 192.168.177.208/32  
Status: Running  
IP: 192.168.177.208  
Controlled By: ReplicaSet/app-ubuntu3-55f4898cb6  
Containers:  
app-ubuntu3:  
Container ID: docker://83aa8d5cb9ee6c78b2b9b099ed04d40aa70ffcd275acb60d2f3fe200fb381733  
Image: ubuntu:latest  
Image ID: docker-pullable://ubuntu@sha256:9b1702dcfe32c873a770a32cfd306dd7fc1c4fd134adfb783db68defc8894b3c  
Port:   
Host Port:   
State: Waiting  
Reason: CrashLoopBackOff  
Last State: Terminated  
Reason: Completed  
Exit Code: 0  
Started: Tue, 16 Jul 2019 11:33:23 +0530  
Finished: Tue, 16 Jul 2019 11:33:23 +0530  
Ready: False  
Restart Count: 50  
Environment:   
Mounts:  
/var/run/secrets/kubernetes.io/serviceaccount from default-token-5xps2 (ro)  
Conditions:  
Type Status  
Initialized True  
Ready False  
ContainersReady False  
PodScheduled True  
Volumes:  
default-token-5xps2:  
Type: Secret (a volume populated by a Secret)  
SecretName: default-token-5xps2  
Optional: false  
QoS Class: BestEffort  
Node-Selectors:   
Tolerations: [node.kubernetes.io/not-ready:NoExecute](http://node.kubernetes.io/not-ready:NoExecute) for 300s  
[node.kubernetes.io/unreachable:NoExecute](http://node.kubernetes.io/unreachable:NoExecute) for 300s  
Events:  
Type Reason Age From Message

* * *

Normal Pulled 18h (x28 over 20h) kubelet, knode Successfully pulled image “ubuntu:latest”  
Normal Pulling 18h (x31 over 20h) kubelet, knode Pulling image “ubuntu:latest”  
Warning BackOff 17h (x674 over 20h) kubelet, knode Back-off restarting failed container  
Normal SandboxChanged 18m (x7 over 20m) kubelet, knode Pod sandbox changed, it will be killed and re-created.  
Normal Pulling 17m (x3 over 18m) kubelet, knode Pulling image “ubuntu:latest”  
Normal Pulled 16m (x3 over 18m) kubelet, knode Successfully pulled image “ubuntu:latest”  
Normal Created 16m (x3 over 18m) kubelet, knode Created container app-ubuntu3  
Normal Started 16m (x3 over 17m) kubelet, knode Started container app-ubuntu3  
Warning BackOff 0s (x82 over 17m) kubelet, knode Back-off restarting failed container

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [July 16, 2019, 8:06am UTC](https://discuss.kubernetes.io/t/deployment/7103/14 "2019-07-16T08:06:14Z")

</div>

I think there is no problem with Ubuntu, just that it runs something and stops, so it is restarted. See this part of what you pasted:

Reason: Completed  
Exit Code: 0

That is, the container exit status was 0 (no error) and the reason is it run until completion (i.e. no problem).

Let me explain why this happens in this case.

The idea of a deployment is that is something that needs to be running constantly, like a web server. When you run the nginx image, the nginx process is started and the container is alive as long as that process is alive. If thar process stops running, the container is not alive anymore.

In the case of a deployment, as the assumption is that the containers should be running all the time, they are restarted time after time. After some time, an exponential back off is used to restart it more spaced in time.

I think that is what you are seeing. If, for example, you try to add in the kubernetes yaml a command for the Ubuntu container, that will run for a long time, the container will be running just fine.

For example, you can add something like:

command: [“sleep”, 30m"]

And the Ubuntu container will run fine for 30 mins.

Of course, when you run your application this won’t be a problem because you will be starting your application 🙂

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 16, 2019, 12:02pm UTC](https://discuss.kubernetes.io/t/deployment/7103/15 "2019-07-16T12:02:01Z")

</div>

Thanks for the detailed explanation!

I tried to add the following code to the yaml file but the error isn’t going away. I added the following code to the ‘containers’ section of the yaml file.

livenessProbe:  
exec:  
command:  
- “sleep”  
- 30m"

Any insights on what changes to be made in the yaml file to make the container run for specific period of time in this case?

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [July 16, 2019, 4:20pm UTC](https://discuss.kubernetes.io/t/deployment/7103/16 "2019-07-16T16:20:11Z")

</div>

No problem!

Yes, not a livenessprobe, that are for another thing. Sorry I wasn’t clear, but this is apart from the livenessprobe.

The thing is: the Ubuntu image probably doesn’t run any command or a command that exits. As the command exits, the process dies and so the container. When the container is detected dead, is automatically restarted.

The livenessprobe is to detect issues while the container hasn’t crashed.

So, the deployment will work, if I understand correctly, if you add a “command” section with the sleep. Not a livenessprobe section. Sorry I wasn’t clear before 🙂

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 17, 2019, 12:25pm UTC](https://discuss.kubernetes.io/t/deployment/7103/17 "2019-07-17T12:25:22Z")

</div>

No worries. You have provided a good explanation. Atleast I am now able to understand why the ubuntu image was not running and this is not an error. It is working as designed. Today , I tried with postgres docker image and it has been deployed successfully.

Now I am trying to deploy the springboot services that I have created. To start with, I have created a simple hello world springboot application and trying to deploying it in kubernetes.

However, following exception is coming after it is deployed :-  
Failed to pull image “hello-world-4:latest”: rpc error: code = Unknown desc = Error response from daemon: pull access denied for hello-world-4, repository does not exist or may require ‘docker login’

I will probably have to push this to docker hub and then do the deployment.

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [July 17, 2019, 2:30pm UTC](https://discuss.kubernetes.io/t/deployment/7103/18 "2019-07-17T14:30:18Z")

</div>

Great it is working!

And yes, for the other deployment you will need to push the image to a registry. That should make it reachable for workers 🙂

---

<div class="post-metadata">

**Author:** ![macintoshprime](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/macintoshprime/32/7121_2.png) [@macintoshprime](https://discuss.kubernetes.io/u/macintoshprime)\
**Post date:** [July 17, 2019, 4:41pm UTC](https://discuss.kubernetes.io/t/deployment/7103/19 "2019-07-17T16:41:53Z")

</div>

This will help if you’re using a private registry. [Pull an Image from a Private Registry - Kubernetes](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)

---

<div class="post-metadata">

**Author:** ![Peeyush2019](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/peeyush2019/32/3300_2.png) [@Peeyush2019](https://discuss.kubernetes.io/u/Peeyush2019)\
**Post date:** [July 26, 2019, 9:48am UTC](https://discuss.kubernetes.io/t/deployment/7103/20 "2019-07-26T09:48:48Z")

</div>

I have tried to deploy a small spring boot service (hello-world example) on kubernetes and created two pods for it. One pod of this service is running fine on Master but the other pod is giving me an error below:-

Failed to pull image “172.20.10.3:30123/hello-world”: rpc error: code = Unknown desc = Error response from daemon: Get [https://172.20.10.3:30123/v2/:](https://172.20.10.3:30123/v2/:) http: server gave HTTP response to HTTPS client

I have tried made docker registry as insecure on both master and node.

Any idea why the same service is not running on the Node?

[Next page](https://discuss.kubernetes.io/t/deployment/7103.md?page=2)
