[API][ServerAddress] How to get serverAddress in hostname format?

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.18 and higher
Cloud being used: AWS

Hey guys,

According to the API documentation for ServerAddressByClientCIDR, it’s possible to retrieve the serverAddress in multiple format: hostname, hostname:port, IP or IP:port

So far we can only get the IP:port format which seems to be the default in the latest version when the hostname was the default in versions prior 1.11.

The developers want to retrieve the hostname of the API server for internal checks.
How is it possible to achieve it?


sh-4.4$ curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET "${APISERVER}/api"
  "kind": "APIVersions",
  "versions": [
  "serverAddressByClientCIDRs": [
      "clientCIDR": "",
      "serverAddress": ""

Thank you for your help.


Any chance that someone can provide some help about it?