I’ve been struggling for a couple of days trying to figure out two problems with my MetalLB enabled LoadBalancer Service.
Here I will focus on the 1st problem. If I can solve that then I will move on to the second.
Setup
My cluster has two nodes.
Master: tonga.corp.sensis.com
Worker: spain.corp.sensis.com
tonga is configured to allow pods to be scheduled.
At this point I am pretty sure MetalLB is doing its part, and the problem I am seeing is either in my configuration or in K8S (perhaps kube-proxy).
I’ve got a simple RESTful service that listens on 8080. The “kubia-unhealthy” service code was actually drawn from the Kubernetes In Action book.
I’ve deployed 2 replicas within a ReplicaSet.
I have no problem browsing to these replicas using a NodePort.
curl tonga.corp.sensis.com:30123
and
curl spain.corp.sensis.com:30123
both work.
I have created a LoadBalancer service, and MetalLB is properly assigning an IP address. In my case, I’ve just used the MetalLB layer 2 configuration. It assigns my service an ExternalIP 192.168.1.241.
I browse to the service using its port and ExternalIP
curl 192.168.1.141:8080
This works when I curl from either tonga, or spain.
However the response to the request takes just over a minute if the request is routed to the pod on the other node. I know this because the RESTful service responds with its hostname, which is just the pod name.
In the following the first curl request is routed to the pod (kubia-unhealthy-r5kb1) on the local node (tonga), and it returns successfully immediately.
The next curl request is routed to the pod (kubia-unhealthy-thtds) on the other node (spain), and it takes 1 minute to return the service RESTful service response.
By monitoring (tcpdump) the veth to the docker container I’ve verified that the request does not get to the pod on spain until the minute elapses.
In this context a healthy service response says - “I’m not well . Please restart me”, as seen in the screenshot.
Can someone please help me to isolate why it consistently takes a minute to route the request to the pod on the other node?
Cluster information:
Kubernetes version:
1.17
Cloud being used: (put bare-metal if not on a public cloud)
bare-metal
Installation method:
Host OS:
Centos 7
CNI and version:
Flannel 0.11
CRI and version:
You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.