How do you correctly enable and connect the MetalLB addon for Kubespray?

1.8k views Asked by At

I am trying to get my cluster up an running with Kubespray, and I have to say it is a fantastic tool, but I cannot get it quite working correctly for me. Specifically, I am trying to enable the metalLB addon, but it does not seem to work.

After my own attempts failed, I have fallen back to the test steps from the kubespray pull request which added metalLB as an addon, but this still fails.

Pull request kubespray/pull/6238 Link

To bulletpoint my actual steps.

  1. vagrant destroy (to dispose of my last attempt)
  2. Change /inventory/mycluster/group_vars/k8s-cluster/addons.yml to enable MetalLB, version 0.9.3, layer 2, ip range 192.168.1.201-192.168.1.250
  3. Change /inventory/mycluster/group_vars/k8s-cluster/k8s-cluster.yml set kube_network_plugin: flannel, kube_proxy_strict_arp: true and kubeconfig_localhost: true
  4. run ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml --private-key=~/.ssh/id_rsa
  5. vagrant up
  6. kubectl apply -f testlb.yaml (apply the test service from the pull request test)
  7.  kubectl get services
    
     NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
    
     kubernetes   ClusterIP      10.233.0.1      none        443/TCP        169m
    
     my-service   LoadBalancer   10.233.32.158   pending     80:30751/TCP   144m
    

The external-ip for my-service remains pending as it cannot be resolved. No metallb components seem to be running. A lot of text whizzed past during the execution, but I did not see any metallb specific messages.

My plan is to use the cluster to play, learn and develop, ideally with jenkins-x. It is not intended as a production cluster, or for public access.

My network is simple with a broadband hub/router/firewall at 192.168.0.1. That router assigns network addresses in the range 192.168.0.*

My Kubespray cluster is running 3 nodes in virtualbox on a quad core ubuntu machine.

Why does the external-ip remain pending, and how can I resolve this ?

0

There are 0 answers