<p>I have been trying to set up a kubernetes cluster.</p>

<p>I have two ubuntu droplets on digital ocean I am using to do this.</p>

<p>I have set up the master and joined the slave
<a href="https://i.stack.imgur.com/p6elw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p6elw.png" alt="enter image description here"></a></p>

<p>I am now trying to create a secret for my docker credentials so that I can pull private images on the node, however when i run this command (or any other kubectl command e.g. kubectl get nodes) i get this error: The connection to the server localhost:8080 was refused - did you specify the right host or port?</p>

<p>This is however all set up as kubectl on its own shows help.</p>

<p>Does any one know why i might be getting this issue and how I can solve it?</p>

<p>sorry, i have just started with kubernetes, but i am trying to learn.</p>

<p>I understand that you have to set up the cluster on a user that is not root on the master (which I have) is it ok to use root on slaves?</p>

<p>thanks</p>

Matster2
<p><code>kubectl</code> is used to connect and run commands to kubernetes API plane. There is no need to have it configured on worker (slave) nodes.</p>

<p>However if You really need to make kubectl work from worker node You would need to do the following:</p>

<hr>

<p>Createa <code>.kube</code> catalog on worker node:</p>

<pre><code>mkdir -p $HOME/.kube
</code></pre>

<p>Copy the configuration file from master node
<code>/etc/kubernetes/admin.conf</code> to <code>$HOME/.kube/config</code> on worker node.</p>

<p>Then run the following command on worker node:</p>

<pre><code>sudo chown $(id -u):$(id -g) $HOME/.kube/config
</code></pre>

<hr>

<p><strong>Update:</strong></p>

<p>To address Your question in comment.</p>

<p>That is not how kubernetes nodes work.</p>

<p>From <a href="https://kubernetes.io/docs/concepts/#kubernetes-nodes" rel="nofollow noreferrer">kubernetes</a> documentation about Kubernetes Nodes:</p>

<blockquote>
  <p>The nodes in a cluster are the machines (VMs, physical servers, etc) that run your applications and cloud workflows. The Kubernetes master controls each node; you’ll rarely interact with nodes directly.</p>
</blockquote>

<p>This means that the images pulled from private repository will be "handled" by master nodes configuration which is synchronized between all nodes. There is no need to configure anything on the worker (slave) nodes.</p>

<p>Additional information about <a href="https://kubernetes.io/docs/concepts/#kubernetes-control-plane" rel="nofollow noreferrer">Kubernetes Control Plane</a>.</p>

<p>Hope this helps.</p>
