Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

kubernetes

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?

like image 251
Richard Rublev Avatar asked Jun 13 '18 06:06

Richard Rublev


People also ask

Why is my pod stuck 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.

What are pods in servers?

Pods are the smallest, most basic deployable objects in Kubernetes. A Pod represents a single instance of a running process in your cluster. Pods contain one or more containers, such as Docker containers. When a Pod runs multiple containers, the containers are managed as a single entity and share the Pod's resources.

How do you remove pods from kubectl?

Destroy Pod The action of deleting the pod is simple. To delete the pod you have created, just run kubectl delete pod nginx . Be sure to confirm the name of the pod you want to delete before pressing Enter. If you have completed the task of deleting the pod successfully, pod nginx deleted will appear in the terminal.


1 Answers

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).

like image 165
Janos Lenart Avatar answered Sep 19 '22 20:09

Janos Lenart