4

I have followed the steps of installation from metallb website.

And the metallb containers are also running.

After that I deployed an nginx service for testing with service as LoadBalancer. The LoadBalancer is not getting IP from metallb.

Any suggestions on how to fix this?

Mark
  • 344
  • 1
  • 8
uday
  • 462
  • 1
  • 19
  • 34

1 Answers1

1

Since I'm not able to write comments, will add all details and path here.

I used following page for setting up a Metal loadbalancer.

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.6/manifests/namespace.yaml
kubectl apply -f
https://raw.githubusercontent.com/metallb/metallb/v0.9.6/manifests/metallb.yaml
# On first install only
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"

You can verify an installation by running:

kubectl get all -n metallb-system

NAME                              READY   STATUS    RESTARTS   AGE
pod/controller-64f86798cc-cfb5t   1/1     Running   0          8m35s
pod/speaker-8vwhc                 1/1     Running   0          8m35s
pod/speaker-zs8zk                 1/1     Running   0          8m35s

NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE daemonset.apps/speaker 2 2 2 2 2 kubernetes.io/os=linux 8m35s

NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/controller 1/1 1 1 8m35s

NAME DESIRED CURRENT READY AGE replicaset.apps/controller-64f86798cc 1 1 1 8m35s

Documentation says:

The installation manifest does not include a configuration file. MetalLB’s components will still start, but will remain idle until you define and deploy a configmap

So we go to the page related to setting up the configmap, I used a simple layer 2 configuration and created a metallb-configmap.yaml file:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.1.240-192.168.1.250

Once you've done it, you'll need to apply this configmap:

kubectl apply -f metallb-configmap.yaml

Then simple example with nginx deployment:

kubectl create deploy nginx --image=nginx --replicas=1

And service:

kubectl expose deploy nginx --port=80 --type=LoadBalancer

And check if received an external IP address:

kubectl get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx LoadBalancer 10.101.83.208 192.168.1.241 80:31836/TCP 8m44s

Check this works:

curl -L 192.168.1.241

<!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style>

Let me know if you have different results.

moonkotte
  • 358