In kubernetes, I can't access externalIP that is assigned with MetalLB Loadbalancer

8/17/2020

First of all, I am setting up the cluster with kubernetes on premise.<br> As displayed at https://metallb.universe.tf/installation/, I installed MetalLB as followed and configured configmap, deployment, and service.

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

configmap.yaml

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

tutorial.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1
        ports:
        - name: http
          containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
  type: LoadBalancer

After configuration, when I check the services with the command kubectl get svc, there is a nginx service with EXTERNAL-IP.

NAME         TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1       <none>            443/TCP        8d
nginx        LoadBalancer   10.101.179.72   192.168.143.230   80:32190/TCP   22s

And when I enter "192.168.143.230", I can't access that page with the message, "This site can’t be reached 192.168.143.230 took too long to respond".<br> What should I do for accessing that page with EXTERNAL-IP?

-- yhshin
kubernetes
metallb
networking
nginx

1 Answer

12/8/2020

I guess it will be accessible through 192.168.143.230:32190

-- Nurhun
Source: StackOverflow