Kubernetes pod not READY

4/6/2020

I am super new to Kubernetes. I have inherited a side project - really an in progress POC - from another developer that recently left the team. He did a demo from a VM that we still have access to before he abruptly left. After he left we were able to go through his demo and things were working. One of the team members restarted the VM and now things are broken. I've been assigned to figure things out. I've been able to bring all the components back up aside from the Kubernetes part which all stack traces point to being the issue at the moment.

As mentioned I am new to Kubernets, so I lack the vocabulary to do proper searches online.

I have ran a few commands have pasted their output below. If I understand correctly the issue is with the k8s deployment not running: kubectl get all

NAME                        TYPE        CLUSTER-IP      EXTERNAL-IPPORT(S)  AGE                                                 AGE
service/kubernetes          ClusterIP   10.96.0.1       <none>              443/TCP                                             14d
service/app-service-5x7z    NodePort    10.96.215.11    <none>              3000:32155/TCP,3001:32762/TCP,27017:30770/TCP       3d

NAME                                    READY   UP-TO-DATE  AVAILABLE   AGE
deployment.apps/app-deployment-5x7z     0/1     1           0           3d

NAME                                    DESIRED     CURRENT     READY       AGE
replicaset.apps/app-deployment-5x7z     1           1           0           3d

I'm guessing that the issue is with the fact that the READY state is 0/1

Can someone please guide me as to how I can bring this guy back up? Also, I see a lot of heavy documentation online, is there a place with a shallow bank that I can dive into the work of Kubernetes. I'm very excited about this opportunity, but it just hasn't been a smooth start.

-- Handsome Wayfarer
kubernetes

2 Answers

4/17/2020

Writing down my two cents on your solution:

  • After you did the kubeadm reset and kubeadm init your cluster was empty.

1st Problem:

I applied those changes, but now when i run kubectl get all i only get the first line "service/kubernetes" and i no longer get anything regarding app-service-5x7z any chance you could give me a hint as to how to accomplish that [getting back the deployment]?

Solution:

  • You need to find the yaml files responsible for deploying the cluster, it's probably called app-deployment or something similar.

2nd Issue:

Here's my current situation. Since I have no idea what this guy used, i built the docker images, and i updated the service and deployment yaml files to use them. I then ran kubectl apply -f <yaml_folder> which succeeds, but when i run kubectl get pods --watch i see the following: justpaste.it/3p9r1 any suggestions how i could debug and get to the root cause? my understanding is that it's not able to pull the docker image. but since i just created it and it's located on the same machine (not in a registry), not sure what the problem is.

Solution:

From PrePulledImages Documentation:

By default, the kubelet will try to pull each image from the specified registry. However, if the imagePullPolicy property of the container is set to IfNotPresent or Never, then a local image is used (preferentially or exclusively, respectively). All pods will have read access to any pre-pulled images.

If a docker image is in the local registry of the node, you have to set imagePullPolicy: Never on the deployment file. Note that the image must be present on all nodes local repositories to ensure availability.

It's good also to create a Docker Hub Private Repository to ensure availability and integrity.

-- willrof
Source: StackOverflow

4/7/2020

Reset the node by

kubeadm reset -f

Cleanup old flannel installation

rm -rf /var/lib/cni/
rm -rf /run/flannel
rm -rf /etc/cni/

ip link delete cni0
ip link delete flannel.1

and then install Kubernetes

kubeadm init --pod-network-cidr=10.244.0.0/16

Install flannel

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
-- Arghya Sadhu
Source: StackOverflow