I have a two node kubernetes cluster deployed on ec2. One of the nodes is attached with a secondary network interface as below.
NODE 1 --> eth0 (ip1).
NODE 2 --> eth0 (ip2), eth1 (ip3)
We are creating a Load Balancer service with externalIPs
as ip3
,
apiVersion: v1
kind: Service
metadata:
name: test-service
namespace: test-namespace
spec:
type: LoadBalancer
selector:
app: test-service
ports:
- protocol: TCP
port: 12222
targetPort: 12222
name: media-dev
- protocol: TCP
port: 12223
targetPort: 12223
name: dev-test
externalIPs:
- ip3
But this doesn't work and we will not able to access ip3.
Please let me know if there is any what that I can stream traffic from secondary interface (ip3) to the pod.
Try to set kubelet on Node2 to use ip3 from eth1 by setting following flag:
--node-ip <ip3>
in
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
and then
systemctl daemon-reload
systemctl restart kubelet
More info about kubelet: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/