kubernetesbare

Kubernetes loadbalancer with dedicated servers


I have a problem with setting kubernetes loadbalancer/ingress(under port 80 for example).

I don't use it with any cloud, just VPS servers with only one IP per server. I'm was trying install traefik but I don't get external-ip - it's stuck on pending.

I have read that I need something when simulating loadbalancer so I installed MetalLB but it more dedicated from local network not VPS servers and didn't work for me or I can't configure it.

My config-map for MetalLB:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: default
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - node1_ip
      - node2_ip
      - node3_ip

What I should do to on that cluster to be able to expose websites under normal port type 80, or can using reverse proxy like traefik.


Solution

  • You should not put node_ip addresses to MetalLB config file. You need to modify this to match the IP scheme of the network you are connected to with subnet. LoadBalancer IP addresses will be distributed from this range.

    Something like below:

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