kubernetes service external ip pending

by Anish

Posted on Friday January 18, 2019

Referefce

This sample chapter extracted from the book, Kubernetes for DevOps .

Get this book on Just $9 or Ask Author for Discount


Well if you stuck in solving the problem of "kubernetes service external ip pending", let's visit the k8 concept once more time.

  • Run a Hello World application in your cluster:
# kubectl run hello-world --replicas=2 --labels="run=LoadBalancer" --image=gcr.io/google-samples/node-hello:1.0  --port=8080
deployment.apps/hello-world created
  • Create a Service object that exposes the deployment:
# kubectl expose deployment hello-world --type=LoadBalancer --name=lb-service
service/lb-service exposed
  • Display information about the Service:
# kubectl get services lb-service
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
lb-service   LoadBalancer   10.102.78.66   <pending>     8080:31031/TCP   1m

After you create the service, it takes time for the cloud infrastructure to create the load balancer and write its IP address into the Service object

Well All the time passes still kubernetes service external ip pending ?

If Kubernetes is running in an environment that doesn't support LoadBalancer services, the load balancer will not be provisioned, but the service will still behave like a NodePort service, your cloud/K8 engine should support LoadBalancer Service

In that case if you manage to add or EIP or VIP to your node then you can attach to the EXTERNAL-IP of your TYPE=LoadBalancer in k8 cluster, for example attaching the EIP/VIP address to the node 172.16.2.13

[email protected]:/home/ansible# kubectl patch svc lb-service  -p '{"spec": {"type": "LoadBalancer", "externalIPs":["172.16.2.13"]}}'
service/lb-service patched
  • Display information about the Service:
[email protected]:/home/ansible# kubectl get services lb-service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)  AGE
lb-service LoadBalancer 10.102.78.66 172.16.2.13 8080:31031/TCP 10m
  • so you can now access the service at that IP address
[email protected]:/home/ansible# curl 172.16.2.13:8080
Hello Kubernetes!

since it's kubernetes you may encounter some issues, feel free to poke me


Thanku for reading !!! Give a Share for Support

Asking for donation sound bad to me, so i'm raising fund from The Modern Cryptography CookBook for Just $9. Leanpub books Discount coupon first 100 reader. No hurry read the sample chapters here then decide.

Alternatively to support you can buy My all four Cryptography book Just $10.99


Referefce
  • The Modern Cryptography Book.
  • Go lang Cryptography for developers
  • Python Cryptography
  • Cryptography for JavaScript Developer


python Cryptography Topics
Topics
For Coffee/ Beer/ Amazon Bill and further development of the project Support by Purchasing, The Modern Cryptography CookBook for Just $9 Coupon Price

Kubernetes for DevOps

Cryptography for Python Developers

Cryptography for JavaScript Developers

Go lang ryptography for Developers

Here