Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No response when "externalTrafficPolicy" is set to "Local"

Tags:

kubernetes

I cannot reach the following Kubernetes service when externalTrafficPolicy: Local is set. I access it directly through the NodePort but always get a timeout.

{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "echo",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/services/echo",
    "uid": "c1b66aca-cc53-11e8-9062-d43d7ee2fdff",
    "resourceVersion": "5190074",
    "creationTimestamp": "2018-10-10T06:14:33Z",
    "labels": {
      "k8s-app": "echo"
    }
  },
  "spec": {
    "ports": [
      {
        "name": "tcp-8080-8080-74xhz",
        "protocol": "TCP",
        "port": 8080,
        "targetPort": 3333,
        "nodePort": 30275
      }
    ],
    "selector": {
      "k8s-app": "echo"
    },
    "clusterIP": "10.101.223.0",
    "type": "NodePort",
    "sessionAffinity": "None",
    "externalTrafficPolicy": "Local"
  },
  "status": {
    "loadBalancer": {}
  }
}

I know that for this pods of the service need to be available on a node because traffic is not routed to other nodes. I checked this.

like image 573
Johannes Mittendorfer Avatar asked Oct 15 '18 12:10

Johannes Mittendorfer


1 Answers

Not sure where you are connecting from and what command you are typing to test connectivity or what's your environment like. But this is most likely due to this known issue where the node ports are not reachable with externalTrafficPolicy set to Local if the kube-proxy cannot find the IP address for the node where it's running on.

This link sheds more light into the problem. Apparently --hostname-override on the kube-proxy is not working as of K8s 1.10. You have to specify the HostnameOverride option in the kube-proxy ConfigMap. There's also a fix described here that will make it upstream at some point in the future from this writing.

like image 199
Rico Avatar answered Oct 12 '22 21:10

Rico