Kubernetes Deployment Hanging

1/30/2016

Following the Deployment example in the docs. I'm trying to deploy the example nginx. With the following config:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80

So far, the deployment always hangs. I tried to see if for any reason I needed a pod named nginx to be deployed already. That didn't solve the problem.

$ sudo kubectl get deployments
NAME               UPDATEDREPLICAS   AGE
nginx-deployment   0/3               34m

$ sudo kubectl describe deployments
Name:                           nginx-deployment
Namespace:                      default
CreationTimestamp:              Sat, 30 Jan 2016 06:03:47 +0000
Labels:                         app=nginx
Selector:                       app=nginx
Replicas:                       0 updated / 3 total
StrategyType:                   RollingUpdate
RollingUpdateStrategy:          1 max unavailable, 1 max surge, 0 min ready    seconds
OldReplicationControllers:      nginx (2/2 replicas created)
NewReplicationController:       <none>
No events.

When I check the events from kubernetes I see no events which belong to this deployment. Has anyone experienced this before?

The versions are as followed:

Client Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.3", GitCommit:"6a81b50c7e97bbe0ade075de55ab4fa34f049dc2", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.3", GitCommit:"6a81b50c7e97bbe0ade075de55ab4fa34f049dc2", GitTreeState:"clean"}
-- Darth_Evil
deployment
kubernetes

3 Answers

2/12/2016

I found an answer from the issues page

In order to get the deployments to work after you enable it and restart the kube-apiserver, you must also restart the kube-controller-manager.

-- Darth_Evil
Source: StackOverflow

5/16/2018

If the deployment is not creating any pods you could have a look at the events an error might be reported there for example:

kubectl get events --all-namespaces                         
NAMESPACE   LASTSEEN   FIRSTSEEN   COUNT     NAME                   KIND         SUBOBJECT   TYPE      REASON         SOURCE                    MESSAGE
default     8m         2d          415       wordpress              Ingress                  Normal    Service        loadbalancer-controller   no user specified default backend, using system default
kube-lego   2m         8h          49        kube-lego-7c66c7fddf   ReplicaSet               Warning   FailedCreate   replicaset-controller     Error creating: pods "kube-lego-7c66c7fddf-" is forbidden: service account kube-lego/kube-lego2-kube-lego was not found, retry after the service account is created

Also have a look at kubectl get rs --all-namespaces.

-- Chris Stryczynski
Source: StackOverflow

1/31/2016

You can check what is wrong with command kubectl describe pod name_of_your_pod

-- Julien Du Bois
Source: StackOverflow