Kubernetes API server not accessible from external through IP address

11/15/2018

on the node that api server is running, when I call curl localhost:8080/api, I see following

{
  "kind": "APIVersions",
  "versions": [
    "v1"
  ],
  "serverAddressByClientCIDRs": [
    {
      "clientCIDR": "0.0.0.0/0",
      "serverAddress": "192.168.152.201:6443"
    }
  ]
}

However, if I do curl 192.168.152.201:6443/api on same machine, I do not get anything back.

Can anyone explain why this is the case and how I can access api server externally?

-- Brandon Lee
kubernetes

1 Answer

11/15/2018

It's related to routing and when you make a call 192.168.152.201 where your traffic is going to.

Could be one or multiple things, some things to check:

  • Does one of your physical interfaces have 192.168.152.201 configured as its IP address? (ie, ensX, or ethX)

  • What is your default route? What do you get if you type ip route (Linux)

  • If 192.168.152.201 is not one of your physical interfaces, is it an outside service. How do you get from your default route to that?

  • If 192.168.152.201 is, in fact, one of your physical interfaces, do you have any iptables (firewall rules) preventing access to 192.168.152.201:6443 and not 127.0.0.1:6443

-- Rico
Source: StackOverflow