<p>when I am trying to setup pod network using the following</p>

<pre><code>sudo kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
</code></pre>

<p>I get this error, please help</p>

<pre><code>unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml": Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
</code></pre>

<p><strong>UPDATE:</strong>
Doesn't seem to be a permission issue, unlike other question</p>

<p>Found that it's an issue with kubectl not being configured properly.</p>

<p>Fixed the issued by using the following commands for calico network(change accordingly for your network addon plugin)</p>

<pre><code>sudo kubeadm init --pod-network-cidr=192.168.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
</code></pre>

<p>and then run </p>

<pre><code>sudo kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
</code></pre>

<p>and follow the rest accordingly</p>
