<p>I can log into a <em>work terminal</em> via a public IP, and list all the <code>nodes</code> by </p>

<pre><code>kubectl get nodes # only gives me internal IPs
</code></pre>

<p>and also be able to check the basic info by </p>

<pre><code>kubectl cluster-info
</code></pre>

<p>and the basic IP info for the current instance by:</p>

<pre><code>ifconfig # but this gives me public IP not internal
</code></pre>

<p>The problem is I have no idea how to determine <strong>which node</strong> I am currently in: a <code>master</code>? which master (there are several masters) or just a slave? then which slave? </p>

<p>Thanks for the help ;)</p>

Hearen
<p>Some of these commands might show different output based on your Kubernetes cluster, I am showing examples from GKE here.</p>

<p>You can use <code>-owide</code> option to get some additional information:</p>

<pre><code>$kubectl get nodes -owide
NAME                           STATUS    ROLES     AGE       VERSION        EXTERNAL-IP      OS-IMAGE            KERNEL-VERSION   CONTAINER-RUNTIME
gke-test-pool2-772ceaec-0tzf   Ready     &lt;none&gt;    23h       v1.9.7-gke.5   35.200.255.186   Container-Optimized OS from Google   4.4.111+         docker://17.3.2
gke-test-pool2-772ceaec-1722   Ready     &lt;none&gt;    20h       v1.9.7-gke.5   35.200.152.18    Container-Optimized OS from Google   4.4.111+         docker://17.3.2
</code></pre>

<p>From the above output you can use:</p>

<ul>
<li>External IP - the IP address of node (Might differ based on your setup)</li>
<li>Roles - in this case are empty indicating slave nodes as master nodes don't get listed in GKE.</li>
</ul>

<p>Also, you can use labels to get some more information:</p>

<pre><code>$ kubectl get --show-labels nodes
NAME                           STATUS    ROLES     AGE       VERSION        LABELS
gke-test-pool2-772ceaec-0tzf   Ready     &lt;none&gt;    23h       v1.9.7-gke.5   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/fluentd-ds-ready=true,beta.kubernetes.io/instance-type=n1-standard-1,beta.kubernetes.io/os=linux,cloud.google.com/gke-nodepool=pool2,cloud.google.com/gke-preemptible=true,failure-domain.beta.kubernetes.io/region=asia-south1,failure-domain.beta.kubernetes.io/zone=asia-south1-b,kubernetes.io/hostname=gke-test-pool2-772ceaec-0tzf
gke-test-pool2-772ceaec-1722   Ready     &lt;none&gt;    20h       v1.9.7-gke.5   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/fluentd-ds-ready=true,beta.kubernetes.io/instance-type=n1-standard-1,beta.kubernetes.io/os=linux,cloud.google.com/gke-nodepool=pool2,cloud.google.com/gke-preemptible=true,failure-domain.beta.kubernetes.io/region=asia-south1,failure-domain.beta.kubernetes.io/zone=asia-south1-b,kubernetes.io/hostname=gke-test-pool2-772ceaec-1722
</code></pre>

<p>From this output, you can:</p>

<ul>
<li>The node pool in labels tells me that it is part of pool2 worker/slave pool</li>
<li>Hostname in labels might be helpful based on your setup.</li>
</ul>

<p>You can match above information with <code>ifconfig</code> to figure out the IP of your node. Lastly - it is not necessary that the terminal you are logged in is one of the nodes in the cluster. </p>

<p>Lastly, it could very well be a node which is outside cluster with <code>Kubeconfig</code> and <code>kubectl</code> configured.</p>
