1 right host or port
The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决方法:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

2 初始化 healthz
The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused
解决方法
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://q5vcymug.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
systemctl restart docker
kubeadm reset -f
3 检查不健康 healthz
kubectl get cs
报错:
Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection

解决方法:
vim /etc/kubernetes/manifests/kube-controller-manager.yaml
注释掉27行:# - --port=0
vim /etc/kubernetes/manifests/kube-scheduler.yaml
注释掉19行:# - --port=0
然后master节点重启:kubelet(等待几秒即可)
systemctl restart kubelet.service
<h2><a id="1_right_host_or_port_0"></a>1 right host or port</h2>
<p><code>The connection to the server localhost:8080 was refused - did you specify the right host or port?</code><br />
解决方法:</p>
<pre><div class="hljs"><code class="lang-shell">mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
</code></div></pre>
<p><img src="https://static.couragesteak.com/article/c67eb9749f8e2a3ba403aed50cd1f0a9.png" alt="image.png" /></p>
<h2><a id="2__healthz_10"></a>2 初始化 healthz</h2>
<p><code>The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused</code></p>
<p>解决方法</p>
<pre><div class="hljs"><code class="lang-shell">vim /etc/docker/daemon.json
</code></div></pre>
<pre><div class="hljs"><code class="lang-shell">{
"registry-mirrors": ["https://q5vcymug.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
</code></div></pre>
<pre><div class="hljs"><code class="lang-shell">systemctl restart docker
kubeadm reset -f
</code></div></pre>
<h2><a id="3___healthz_32"></a>3 检查不健康 healthz</h2>
<pre><div class="hljs"><code class="lang-shell">kubectl get cs
</code></div></pre>
<p>报错:<br />
<code>Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection</code></p>
<p><img src="https://static.couragesteak.com/article/d08fcf5f2051a94f62b747cb9f9e3d4c.png" alt="image.png" /></p>
<p>解决方法:</p>
<pre><div class="hljs"><code class="lang-shell">vim /etc/kubernetes/manifests/kube-controller-manager.yaml
</code></div></pre>
<p>注释掉27行:<code># - --port=0</code></p>
<pre><div class="hljs"><code class="lang-shell">vim /etc/kubernetes/manifests/kube-scheduler.yaml
</code></div></pre>
<p>注释掉19行:<code># - --port=0</code></p>
<p>然后master节点重启:kubelet(等待几秒即可)</p>
<pre><div class="hljs"><code class="lang-shell">systemctl restart kubelet.service
</code></div></pre>
留言