<p>I have a kubernetes cluster</p>

<p>In Master node,</p>

<p>If I give the command <code>kubectl get nodes</code> it should show all the nodes.</p>

<p>But, If I give the same command in nodes it should not show the master node.</p>

<p>Is it possible in kubernetes?</p>

<p>Please help anyone. Thanks in advance.</p>

az rnd
<p>No, this is not possible. The kubernetes API will always respond to the same queries in the same way. <code>kubectl get nodes</code> is asking for information about all nodes, and the api will always answer an authorized user with all of the nodes. </p>

<p>With RBAC it is possible to limit what a particular user or account has access to view or edit, but the <code>nodes</code> resource is not namespaced, and does not give granularity to restrict access to certain nodes.</p>

<p>You can, however, filter the results of <code>kubectl get nodes</code> any way you like. <a href="https://stackoverflow.com/a/52434076/121660">This question</a> has some good examples of showing only worker nodes using the <code>-l</code> argument to kubectl.</p>
