Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes service stays in pending state

Service showing pending status after exposing the deployment.

packet@ubuntu:/home/gss$ kubectl get services
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes   ClusterIP      10.96.0.1       <none>        443/TCP          22h
wms1         LoadBalancer   10.106.19.103   <pending>     8000:32461/TCP   17h

Installed kubeadm with one master and 4 worker nodes. created deployment with the command:

sudo docker run -p 8000:8000 w1

here w1 is my image name.

created service with the command:

kubectl expose deployment wms1 --type=LoadBalancer --port=8000
like image 791
samba Avatar asked Nov 07 '22 23:11

samba


1 Answers

To retrieve external ip for your application in Kubernetes Cluster you have to use cloud provider like Google Kubernetes Engine or Amazon Web Services.

Please check: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#external-load-balancer-providers

Otherwise you can use Type NodePort and in that case Kubernetes master will allocate a port from a range specified by --service-node-port-range flag (default: 30000-32767), and each Node will proxy that port (the same port number on every Node) into your Service.

For detailed information: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport

like image 52
coolinuxoid Avatar answered Nov 15 '22 09:11

coolinuxoid