Why unable to access a service if setting externalTrafficPolicy to Local in a kubernetes cluster
Create kube-proxy.yaml
kubectl get ds -n kube-system kube-proxy -o yaml > kube-proxy.yaml
Edit kube-proxy.yaml
to include the HOST_IP
argument
# ...spec: containers: - command: - ./hyperkube - proxy - --cluster-cidr=10.2.0.0/16 - --hostname-override=$(HOST_IP) - --kubeconfig=/etc/kubernetes/kubeconfig - --proxy-mode=iptables env: - name: HOST_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.hostIP #...
Update the pods:
kubectl apply -f kube-proxy.yaml
This will apply the fix mentioned in https://github.com/kubernetes/kubernetes/issues/48437, resolving the dropped packets issue.