<p>I've installed, Docker, Kubectl and kubeAdm.
I want to create my device model and device CRDs (I'm following this <a href="https://docs.kubeedge.io/en/latest/setup/setup.html" rel="noreferrer">guide</a>.
So, when I run the command :</p>
<pre><code>kubectl create -f devices_v1alpha1_devicemodel.yaml
</code></pre>
<p>as a user I get the following out:</p>
<pre><code>The connection to the server 10.0.0.68:6443 was refused - did you
specify the right host or port?
</code></pre>
<p>(I have added the permission for the user to access the .kube folder)</p>
<p>With netstat, I get :</p>
<pre><code>&gt; ubuntu@kubernetesmaster:~/src/github.com/kubeedge/kubeedge/build/crds/devices$
&gt; sudo netstat -atunp    Active Internet connections (servers and
&gt; established)                                                 Proto
&gt; Recv-Q Send-Q Local Address           Foreign Address         State   
&gt; PID/Program name      tcp        0      0 0.0.0.0:22             
&gt; 0.0.0.0:*               LISTEN      1298/sshd             tcp        0    224 10.0.0.68:22            160.98.31.160:52503     ESTABLISHED
&gt; 2061/sshd: ubuntu [   tcp6       0      0 :::22                   :::*
&gt; LISTEN      1298/sshd             udp        0      0 0.0.0.0:68      
&gt; 0.0.0.0:*                           910/dhclient          udp        0      0 10.0.0.68:123           0.0.0.0:*                          
&gt; 1241/ntpd             udp        0      0 127.0.0.1:123          
&gt; 0.0.0.0:*                           1241/ntpd             udp        0      0 0.0.0.0:123             0.0.0.0:*                          
&gt; 1241/ntpd             udp6       0      0 fe80::f816:3eff:fe0:123 :::*
&gt; 1241/ntpd             udp6       0      0 2001:620:5ca1:2f0:f:123 :::*
&gt; 1241/ntpd             udp6       0      0 ::1:123                 :::*
&gt; 1241/ntpd             udp6       0      0 :::123                  :::*
&gt; 1241/ntpd
</code></pre>
<p>With lsof -i :</p>
<pre><code>ubuntu@kubernetesmaster:~/src/github.com/kubeedge/kubeedge/build/crds/devices$ sudo lsof -i
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dhclient  910   root    6u  IPv4  12765      0t0  UDP *:bootpc
ntpd     1241    ntp   16u  IPv6  15340      0t0  UDP *:ntp
ntpd     1241    ntp   17u  IPv4  15343      0t0  UDP *:ntp
ntpd     1241    ntp   18u  IPv4  15347      0t0  UDP localhost:ntp
ntpd     1241    ntp   19u  IPv4  15349      0t0  UDP 10.0.0.68:ntp
ntpd     1241    ntp   20u  IPv6  15351      0t0  UDP ip6-localhost:ntp
ntpd     1241    ntp   21u  IPv6  15353      0t0  UDP [2001:620:5ca1:2f0:f816:3eff:fe0a:874a]:ntp
ntpd     1241    ntp   22u  IPv6  15355      0t0  UDP [fe80::f816:3eff:fe0a:874a]:ntp
sshd     1298   root    3u  IPv4  18821      0t0  TCP *:ssh (LISTEN)
sshd     1298   root    4u  IPv6  18830      0t0  TCP *:ssh (LISTEN)
sshd     2061   root    3u  IPv4  18936      0t0  TCP 10.0.0.68:ssh-&gt;160.98.31.160:52503 (ESTABLISHED)
sshd     2124 ubuntu    3u  IPv4  18936      0t0  TCP 10.0.0.68:ssh-&gt;160.98.31.160:52503 (ESTABLISHED)
</code></pre>
<p>I've already tried <a href="https://stackoverflow.com/questions/51121136/the-connection-to-the-server-localhost8080-was-refused-did-you-specify-the-ri">this</a>
and:<code>sudo swapoff -a</code></p>

<p>I am facing similar problem with following error while deploying the pod network into a cluster using flannel:</p>
<pre><code>$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
The connection to the server 192.168.1.101:6443 was refused - did you specify the right host or port?
</code></pre>
<p>I performed below steps to solved the issue:</p>
<pre><code>$ sudo systemctl stop kubelet
$ sudo systemctl start kubelet
$ strace -eopenat kubectl version
</code></pre>
<p>then apply the yml file</p>
<pre><code>$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created
</code></pre>
