by Anish
Posted on Friday January 18, 2019
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.
# 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
# kubectl expose deployment hello-world --type=LoadBalancer --name=lb-service
service/lb-service exposed
# 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
root@kube-master:/home/ansible# kubectl patch svc lb-service -p '{"spec": {"type": "LoadBalancer", "externalIPs":["172.16.2.13"]}}'
service/lb-service patched
root@kube-master:/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
root@kube-master:/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
Instead of directly asking for donations, I'm thrilled to offer you all nine of my books for just $9 on leanpub By grabbing this bundle you not only help cover my coffee, beer, and Amazon bills but also play a crucial role in advancing and refining this project. Your contribution is indispensable, and I'm genuinely grateful for your involvement in this journey!
Any private key value that you enter or we generate is not stored on this site, this tool is provided via an HTTPS URL to ensure that private keys cannot be stolen, for extra security run this software on your network, no cloud dependency