1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Kubernetes エラー】 Error from server: error dialing backend: dial tcp :10250: getsockopt: connection refused

Last updated at Posted at 2019-01-22

##現象
Kubernetesクラスタ構成のマスターノード上のPodにおいて、kubectl exec (コンテナ内のコマンド実行)が、下記のエラーメッセージで失敗する
※ワーカーノード上のコマンド実行は成功

[Error from server: error dialing backend: dial tcp :10250: getsockopt: connection refused]

[root@master ~]# kubectl get pods -o wide
NAME                                 READY     STATUS    RESTARTS   AGE       IP             NODE
sample-deployment-3071066810-l4qn1   1/1       Running   0          1h        172.17.0.3     worker
sample-deployment-3071066810-qlt24   1/1       Running   0          1h        172.17.0.2     worker
sample-deployment-3071066810-xx2p5   1/1       Running   6          1h        172.17.0.131   master
sample-env                           1/1       Running   6          30m       172.17.0.130   master

[root@master ~]# kubectl exec -it sample-deployment-3071066810-xx2p5 /bin/bash
Error from server: error dialing backend: dial tcp 10.44.59.113:10250: getsockopt: connection refused」

[root@master ~]# kubectl exec -it sample-deployment-3071066810-l4qn1 /bin/bash
root@sample-deployment-3071066810-l4qn1:/#

##前提

##対処
KUBELET_ADDRESSを、マスター自身のIPアドレス(今回はAPI Serverと兼用)に変更

[root@master ~]# vi /etc/kubernetes/kubelet
# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=127.0.0.1"

→ 
KUBELET_ADDRESS="--address=10.44.59.113"
KUBELET_API_SERVER="--api-servers=http://10.44.59.113:8080"

##原因
API Serverと、マスターノード上のKubeletサービス間の通信エラー

##参考
image.png
出典:Wikipedia「Kubernetes」

  • API server:
    REST APIにて各ノード(master/worker)の設定を実施し、Kubernetesの内部/外部インターフェースを提供するコンポーネント

  • Kubelet:
    各ノード及びノード内のPod(コンテナの集合単位)の状態を監視し、障害のあったPodを自動的に再デプロイするコンポーネント

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?