metallb: Service from external IP is unreachable

i have kubernetes cluster with master node 192.168.215.50/28 worker1 node 192.168.215.51/28 worker2 node 192.168.215.52/28 worker3 node 192.168.215.53/28

my router 192.168.215.49/28

  • Version of MetalLB 0.13.7
  • Version of Kubernetes 1.25
  • Name and version of network addon flannel with kube proxy
$ kubectl get pods  -n metallb-system
NAME                          READY   STATUS    RESTARTS       AGE
controller-86df6cb554-rx8sn   1/1     Running   0              36m
speaker-2cz88                 1/1     Running   4 (9h ago)     20h
speaker-jg8hh                 1/1     Running   4 (9h ago)     20h
speaker-ss4qg                 1/1     Running   4 (9h ago)     20h
speaker-zr98c                 1/1     Running   12 (46m ago)   20h
~$ kubectl get all  -n metallb-system
NAME                              READY   STATUS    RESTARTS       AGE
pod/controller-86df6cb554-rx8sn   1/1     Running   0              39m
pod/speaker-2cz88                 1/1     Running   4 (9h ago)     20h
pod/speaker-jg8hh                 1/1     Running   4 (9h ago)     20h
pod/speaker-ss4qg                 1/1     Running   4 (9h ago)     20h
pod/speaker-zr98c                 1/1     Running   12 (49m ago)   20h

NAME                      TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/webhook-service   ClusterIP   10.102.21.49   <none>        443/TCP   20h

NAME                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/speaker   4         4         4       4            4           kubernetes.io/os=linux   20h

NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/controller   1/1     1            1           20h

NAME                                    DESIRED   CURRENT   READY   AGE
replicaset.apps/controller-84d6d4db45   0         0         0       20h
replicaset.apps/controller-86df6cb554   1         1         1       39m
~$ cat metallb/ipaddress_pools.yaml 
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: production
  namespace: metallb-system
spec:
  addresses:
  - 192.168.215.55-192.168.215.58
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: l2-advert
  namespace: metallb-system
~$ kubectl describe ipaddresspools.metallb.io production -n metallb-system
Name:         production
Namespace:    metallb-system
Labels:       <none>
Annotations:  <none>
API Version:  metallb.io/v1beta1
Kind:         IPAddressPool
Metadata:
  Creation Timestamp:  2022-12-31T08:25:48Z
  Generation:          6
  Managed Fields:
    API Version:  metallb.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:addresses:
        f:autoAssign:
        f:avoidBuggyIPs:
    Manager:         kubectl-client-side-apply
    Operation:       Update
    Time:            2023-01-01T04:41:13Z
  Resource Version:  215612
  UID:               13712c07-a1df-412e-91fc-d15e5ee3b814
Spec:
  Addresses:
    192.168.215.55-192.168.215.58
  Auto Assign:       true
  Avoid Buggy I Ps:  false
Events:              <none>

i deploy example service use metalLB loadbalancer

~$ cat web-demo/web-app-demo.yaml 
apiVersion: v1
kind: Namespace
metadata:
  name: web
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-server
  namespace: web
spec:
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: httpd
        image: httpd:alpine
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: web-server-service
  namespace: web
spec:
  selector:
    app: web
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: LoadBalancer
  externalTrafficPolicy: Cluster

i change externalTrafficPolicy Local or Cluster but i cant access my service from external IP

~$ kubectl get all -n web
NAME                             READY   STATUS    RESTARTS   AGE
pod/web-server-5f6774755-fqxb8   1/1     Running   0          22m

NAME                         TYPE           CLUSTER-IP    EXTERNAL-IP      PORT(S)        AGE
service/web-server-service   LoadBalancer   10.100.2.99   192.168.215.55   80:31636/TCP   22m

NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/web-server   1/1     1            1           22m

NAME                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/web-server-5f6774755   1         1         1       22m
~$ kubectl describe service/web-server-service -n web
Name:                     web-server-service
Namespace:                web
Labels:                   <none>
Annotations:              <none>
Selector:                 app=web
Type:                     LoadBalancer
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.100.2.99
IPs:                      10.100.2.99
LoadBalancer Ingress:     192.168.215.55
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  31636/TCP
Endpoints:                172.17.0.8:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason        Age   From                Message
  ----    ------        ----  ----                -------
  Normal  IPAllocated   20m   metallb-controller  Assigned IP ["192.168.215.55"]
  Normal  nodeAssigned  20m   metallb-speaker     announcing from node "k8s-worker1-jbd" with protocol "layer2"
  Normal  nodeAssigned  17m   metallb-speaker     announcing from node "k8s-master-jbd" with protocol "layer2"

i try troubleshoot using arping

sudo arping -I eth0 192.168.215.55
ARPING 192.168.215.55
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout
Timeout

where is my mistake? please help

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 17 (4 by maintainers)

Most upvoted comments

me too.

Hi, I have the same issue.

Not sure why this is closed… I am getting the same issue.

kubectl get svc
NAME                 TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                                        AGE
infer-server         LoadBalancer   10.107.173.60    192.168.1.242   8000:30726/TCP,8001:31914/TCP,8002:31520/TCP   44h

Then when I try :

curl -v 192.168.1.242:8000/v2/health/ready 

It keeps thinking without giving me a response (it should take less than 1s)

*   Trying 192.168.1.242:8000...