5

I have installed Kubernetes in Ubuntu server using instructions here. I am trying to create pods using kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --hostport=8000 --port=8080 as listed in the example. However, when I do kubectl get pod I get the status of the container as pending. I further did kubectl describe pod for debugging and I see the message:

FailedScheduling pod (hello-minikube-3383150820-1r4f7) failed to fit in any node fit failure on node (minikubevm): PodFitsHostPorts.

I am further trying to delete this pod by kubectl delete pod hello-minikube-3383150820-1r4f7 but when I further do kubectl get pod I see another pod with prefix "hello-minikube-3383150820-" that I havent created. Does anyone know how to fix this problem? Thank you in advance.

rmb
  • 1,737
  • 4
  • 14
  • 20

1 Answers1

3

The PodFitsHostPorts predicate is failing because you have something else on your nodes using port 8000. You might be able to find what it is by running kubectl describe svc.

kubectl run creates a deployment object (you can see it with kubectl describe deployments) which makes sure that you always keep the intended number of replicas of the pod running (in this case 1). When you delete the pod, the deployment controller automatically creates another for you. If you want to delete the deployment and the pods it keeps creating, you can run kubectl delete deployments hello-minikube.

CJ Cullen
  • 5,452
  • 1
  • 26
  • 34
  • I see. Thank you. I am able to delete my pods now. However as far as the status of the pods is considered, all pods are in the 'Container Creating' state. It seems to be that their respective images arent being pulled from the gcr.io repository. I tried to pull them using docker but still I am getting the same status. Do you know how to fix this? Has it something to do with the network configuration of the docker VM that minikube created? – rmb Jul 11 '16 at 19:08
  • Does the `docker pull` fail with a similar error? If that also fails, its possible that the node VMs are not configured correctly to reach the external internet. – CJ Cullen Jul 11 '16 at 20:10
  • Well it failed initially but after I entered proxy information as mentioned in http://stackoverflow.com/questions/23111631/cannot-download-docker-images-behind-a-proxy the error was resolved. However, when I do kubectl run image=imagename the status is 'Container Creating'. – rmb Jul 11 '16 at 20:23
  • Are you using minikube's built-in docker daemon? (`eval $(minikube docker-env)`). If so, I'd think that if you can docker pull the image there, the docker VM that minikube created would be able to get the image as well, but I'm not that familiar with minikube's internals – CJ Cullen Jul 11 '16 at 20:37
  • Some proxy info was missing and after configuring the proxy the problem was resolved. – rmb Jul 12 '16 at 11:38
  • Awesome! Glad that you figured it out. – CJ Cullen Jul 12 '16 at 18:12
  • hey adding to this, `eval $(minikube docker-env)` reports `E0712 23:24:22.333128 112863 notify.go:54] Get https://storage.googleapis.com/minikube/releases.json: dial tcp 172.217.3.208:443: i/o timeout`. Looks like the docker inside the VM is not able to reach the Internet – nikk Jul 12 '16 at 22:32
  • Yes and this you can fix my adding your proxies in /var/lib/boot2docker/profile inside the minikube vm and then do /etc/init.d/docker restart. – rmb Jul 15 '16 at 13:45
  • Im unable to find profile file in /var/lib/boot2docker directory – user2439278 Jan 24 '18 at 13:23