[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?

Example:

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

Thank you for your help.

Cheers,

Any chance that someone can provide some help about it?

Cheers,