Kubernetes-kubectl:サーバーはlocalhostへの接続:8080は拒否されました

プライマリノードKubernetesコマンド]で実行されている[kubectl次のエラーが発生しました

[root@k8s-master kubernetes]# kubectl get pod
The connection to the server localhost:8080 was refused - did you specify the right host or port?

コマンドが実行にkubectlのkubernetes管理者を必要とするため、この問題が発生します。
ソリューションは、以下のようにしているノードから同じディレクトリにノード/etc/kubernetes/admin.conf] [ファイルのマスターをコピーし、環境変数を設定:
メインノード:

scp -r /etc/kubernetes/admin.conf ${master}:/etc/kubernetes/admin.conf

ノードから:

echo “export KUBECONFIG=/etc/kubernetes/admin.conf” >> ~/.bash_profile
source ~/.bash_profile

例:
マスター

 $ scp -r /etc/kubernetes/admin.conf ${k8s-node1}:/etc/kubernetes/admin.conf

ワーカー

$ echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
$ source ~/.bash_profile
リリース6元記事 ウォンの賞賛0 ビュー1065

おすすめ

転載: blog.csdn.net/weixin_43394724/article/details/96478642