Error from server (BadRequest): pod kubia-zgxn9 does not have a host assigned

6/13/2018

When I run exec command

 kubectl exec kubia-zgxn9 -- curl -s http://10.47.252.17
Error from server (BadRequest): pod kubia-zgxn9 does not have a host assigned

Describe pod shows host

IP:             
Controlled By:  ReplicationController/kubia
Containers:
  kubia:
    Image:      luksa/kubia
    Port:       8080/TCP
    Host Port:  0/TCP
    Requests:
      cpu:        100m
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-xs7qx (ro)

This is my service

Name:              kubia
Namespace:         default
Labels:            <none>
Annotations:       <none>
Selector:          app=kubia
Type:              ClusterIP
IP:                10.47.252.17
Port:              <unset>  80/TCP
TargetPort:        8080/TCP
Endpoints:         <none>
Session Affinity:  None
Events:            <none>

Why did I get error from server?

-- Richard Rublev
kubernetes

1 Answer

6/13/2018

The Pod is probably not yet scheduled to a Node.

Maybe it just took a little longer than expected or perhaps it's asking for resources that no node can satisfy at the moment.

Check the output of kubectl get pod kubia-zgxn9 and see if the state is Running. If so, retry now. If it still fails to exec this might be a bug.

If it's not running, check the describe output for notices. (Unfortunately you cut the output short in your question so we can't see what's wrong with it).

-- Janos Lenart
Source: StackOverflow