web-dev-qa-db-ja.com

kubernetes-サーバーに接続できません:tcp i / oタイムアウトをダイヤルします

Kubectl versionコマンドを実行すると、次のエラーメッセージが表示されます。

 kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/AMD64"}
Unable to connect to the server: dial tcp 192.168.99.100:8443: i/o timeout

どうすれば解決できますか?

11
IT_novice

次のコマンドを使用して、クライアントとサーバーのステータスに関する関連情報を取得できます。

kubectl config view 

これで、次のコマンドを使用して、k8sコンテキストを適宜更新または設定できます。

kubectl config use-context kubernetes

kubeconfigファイルでさらにアクションを実行できます。次のコマンドは、必要なすべての情報を提供します。

kubectl config --help
8
Suresh Vishnoi

最初に実行する必要があります

minikube start

端末で。これにより、次のことが行われます。

 Restarting existing virtualbox VM for "minikube" ...
⌛  Waiting for SSH access ...
????  "minikube" IP address is 192.168.99.100
????  Configuring Docker as the container runtime ...
????  Version of container runtime is 18.06.3-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
????  Pulling images required by Kubernetes v1.14.1 ...
????  Relaunching Kubernetes v1.14.1 using kubeadm ... 
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
????  Updating kube-proxy configuration ...
????  Verifying component health ......
????  kubectl is now configured to use "minikube"
????  Done! Thank you for using minikube!
5

Minikubeを使用する場合は、kubectl config use-context minikube kubernetesに付属するデスクトップ用の最新のdockerを使用する場合は、実行する必要があります、kubectl config use-context docker-for-desktop

1
Khalid

実行すると同様の問題が発生しました

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/AMD64"}
Unable to connect to the server: dial tcp 192.168.99.100:8443: i/o timeout

そして、ここに私がやってみて最終的に働いた方法があります。

Docker Desktopを最初にMac(バージョン2.0.0.3)にインストールしました。次に、コマンドでkubectlをインストールしました

$ brew install kubectl
.....
==> Pouring kubernetes-cli-1.16.0.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/kubectl
Target /usr/local/bin/kubectl
already exists. You may want to remove it:
  rm '/usr/local/bin/kubectl'

To force the link and overwrite all conflicting files:
  brew link --overwrite kubernetes-cli

To list all files that would be deleted:
  brew link --overwrite --dry-run kubernetes-cli

Possible conflicting files are:
/usr/local/bin/kubectl -> /Applications/Docker.app/Contents/Resources/bin/kubectl
.....

それは問題ではありません。すでにkubectlを入手しています。次に、コマンドでminikubeをインストールします

$ brew cask install minikube
...
==> Linking Binary 'minikube-darwin-AMD64' to '/usr/local/bin/minikube'.
????  minikube was successfully installed!

minikubeを初めて起動する(VirtualBoxがインストールされていない)

$ minikube start
????  minikube v1.4.0 on Darwin 10.13.6
????  Downloading VM boot image ...
    > minikube-v1.4.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.4.0.iso: 135.73 MiB / 135.73 MiB [-] 100.00% 7.75 MiB p/s 18s
????  Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
????  Retriable failure: create: precreate: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path
...
????  Unable to start VM
❌  Error: [VBOX_NOT_FOUND] create: precreate: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path
????  Suggestion: Install VirtualBox, or select an alternative value for --vm-driver
????  Documentation: https://minikube.sigs.k8s.io/docs/start/
⁉️   Related issues:
    ▪ https://github.com/kubernetes/minikube/issues/3784

VirtualBoxをインストールしてから、2回目のminikubeの起動(VirtualBoxのインストール)

$ minikube start
????  13:37:01.006849   35511 cache_images.go:79] CacheImage kubernetesui/dashboard:v2.0.0-beta4 -> /Users/kaka.go/.minikube/cache/images/kubernetesui/dashboard_v2.0.0-beta4 failed: read tcp 10.49.52.206:50350->104.18.125.25:443: read: operation timed out
????  Preparing Kubernetes v1.16.0 on Docker 18.09.9 ...
E1002 13:37:33.632298   35511 start.go:706] Error caching images:  Caching images for kubeadm: caching images: caching image /Users/kaka.go/.minikube/cache/images/kubernetesui/dashboard_v2.0.0-beta4: read tcp 10.49.52.206:50350->104.18.125.25:443: read: operation timed out
❌  Unable to load cached images: loading cached images: loading image /Users/kaka.go/.minikube/cache/images/kubernetesui/dashboard_v2.0.0-beta4: stat /Users/kaka.go/.minikube/cache/images/kubernetesui/dashboard_v2.0.0-beta4: no such file or directoryminikube v1.4.0 on Darwin 10.13.6
????  Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
E1002 
????  Downloading kubeadm v1.16.0
????  Downloading kubelet v1.16.0
????  Pulling images ...
????  Launching Kubernetes ... 

????  Error starting cluster: timed out waiting to elevate kube-system RBAC privileges: Temporary Error: creating clusterrolebinding: Post https://192.168.99.100:8443/apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings: dial tcp 192.168.99.100:8443: i/o timeout

????  Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
????  https://github.com/kubernetes/minikube/issues/new/choose
❌  Problems detected in kube-addon-manager [b17d460ddbab]:
    error: no objects passeINFO:d  == Kuto apberneply
    error: no objectNsF Op:a == Kubernetssed tes ado appdon ely

ミニクベ3回目開始

$ minikube start
????  minikube v1.4.0 on Darwin 10.13.6
????  Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
????  Using the running virtualbox "minikube" VM ...
⌛  Waiting for the Host to be provisioned ...
????  Preparing Kubernetes v1.16.0 on Docker 18.09.9 ...
????  Relaunching Kubernetes using kubeadm ... 

!まだ再起動で立ち往生しました

Dockerの設定でKubernetesの設定を有効にし、Macを再起動してKubernetesコンテキストをdocker-for-desktopに切り替えます。

ああ、今回はkubectlバージョンが動作しますが、コンテキストdocker-for-desktopで

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/AMD64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:25:46Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/AMD64"}

4回目のminikubeの開始(システムの再起動後)

$ minikube start
????  minikube v1.4.0 on Darwin 10.13.6
????  Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
????  Starting existing virtualbox VM for "minikube" ...
⌛  Waiting for the Host to be provisioned ...
????  Preparing Kubernetes v1.16.0 on Docker 18.09.9 ...
????  Relaunching Kubernetes using kubeadm ... 
⌛  Waiting for: apiserver proxy etcd scheduler controller dns
????  Done! kubectl is now configured to use "minikube"

最後に、minikubeコンテキストで動作します...

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/AMD64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/AMD64"}
0
gokaka

私はファイアウォールのポートをチェックし、それが閉じられた、私はそれを開いて、それが動作し始めました。

0