Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes Deployment Hanging

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"}
like image 487
Darth_Evil Avatar asked Jan 30 '16 06:01

Darth_Evil


People also ask

Why my Deployment is not ready in Kubernetes?

If a Pod is Running but not Ready it means that the Readiness probe is failing. When the Readiness probe is failing, the Pod isn't attached to the Service, and no traffic is forwarded to that instance.

Why is my pod stuck pending?

My pod stays pending If a Pod is stuck in Pending it means that it can not be scheduled onto a node. Generally this is because there are insufficient resources of one type or another that prevent scheduling. Look at the output of the kubectl describe ... command above.

What is rolling Deployment in Kubernetes?

Rolling deployment is the default deployment strategy in Kubernetes. It lets you update a set of pods with no downtime, by incrementally replacing pod instances with new instances that run a new version of the application.


2 Answers

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.

like image 152
Chris Stryczynski Avatar answered Nov 09 '22 23:11

Chris Stryczynski


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.

like image 39
Darth_Evil Avatar answered Nov 10 '22 00:11

Darth_Evil