What is the default 'name' of the kubernetes master cluster host?

8/6/2018

In my heapster.yaml, it references the IP of the master cluster host (https://142.141.33.10:6443). Is there any built-in name I could use for referencing the master host IP? I don't want to hard-coded any static IP's...

spec:
      serviceAccountName: heapster
      containers:
      - name: heapster
        image: k8s.gcr.io/heapster-amd64:v1.5.3
        imagePullPolicy: IfNotPresent
        command:
        - /heapster
        - --source=kubernetes:https://142.141.33.10:6443  
        - --sink=influxdb:http://influxdb:8086
-- user988575
cluster-computing
kubernetes
master

1 Answer

8/6/2018

Assuming you mean the Kubernetes API, you can reference this internally (inside a pod) as:

https://kubernetes.default/

You can obtain an access token from this file:

/var/run/secrets/kubernetes.io/serviceaccount/token

To validate the SSL certificate, you can use this file:

/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
-- John
Source: StackOverflow