Welcome to the Linux Foundation Forum!

Exercise 6.6 loadBalancer external IP in pending

Hello

During exercise 6.6 I am doing something wrong with my load balancer config; While the load balancer appears working correctly (I am able to access the nginx server from outside the node by web and by curl locally using both service and pod IPs), the service is listed as having a pending external IP and I dont know if this is normal (I don't see necesarly to specify the node IP as external IP in the yaml). Any help?

Yaml:
apiVersion: v1
kind: Service
metadata:
name: lb
spec:
selector:
type: nserver
ports:

  • port: 80
    targetPort: 80
    protocol: TCP
    nodePort: 31000
    type: LoadBalancer

kubectl get svc:
lb LoadBalancer 10.111.157.39 <pending> 80:31000/TCP 9m18s

kubectl describe service lb
Name: lb
Namespace: default
Labels:
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"lb","namespace":"default"},"spec":{"ports":[{"nodePort":31000,"po...
Selector: type=nserver
Type: LoadBalancer
IP: 10.111.157.39
Port: 80/TCP
TargetPort: 80/TCP
NodePort: 31000/TCP
Endpoints: 192.168.159.113:80
Session Affinity: None
External Traffic Policy: Cluster
Events:

Thanks in advance!

Stefan

Best Answer

Answers

  • Hi Chris,

    Five years later, I stumbled upon the same issue, which is that exercise 6.6 requests us to create a LoadBalancer Service, even though we are working with a simple two VM setup, without configurations in place to talk to underlying infrastructure to create a LoadBalancer.
    Should the exercise not be updated to ask the student to create a different type of Service instead?

    Regards,
    -Muhammed

  • To follow up, I got it work with the LoadBalancer Service type by manually creating a Load Balancer (in my case on Huawei Cloud), then manually adding a Listener to said Load Balancer, which will forward traffic on port 80 to the two VMs to the NodePort that was created by the LoadBalancer Service.

    Finally I also patched the Service so that Kubernetes would no longer say that there is no external-IP by running
    kubectl patch svc nginx-6 -p '{"spec": {"type": "LoadBalancer", "externalIPs": ["xyz.xyz.xyz.xyz"]}}'

    However, it seems this exercise causes confusion to more people, judging by that a search for "LoadBalancer" shows several entries about exercise 6.6

    Regards,
    -Muhammed

  • Hi @muhammed55053,

    You are correct, this exercise, together with a few others introduced later throughout training, collectively present the three service types - ClusterIP, NodePort, LoadBalancer. The implementation of the LoadBalancer type still depends on a managed Kubernetes platform model, but can be successfully implemented manually such as you have, to capture external traffic for the cluster-external load balancing. A similar implementation can leverage self managed load balancer services (on premises or cloud) with self managed Kubernetes platforms.

    Regards,
    -Chris

Categories

Upcoming Training