【问题标题】:Kubernetes: Unable to connect to the serverKubernetes:无法连接到服务器
【发布时间】:2017-02-28 04:43:36
【问题描述】:

我在这里关注 Kubernetes 指南:https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-ram-container/

当我运行这个命令时:

kubectl create -f http://k8s.io/docs/tasks/configure-pod-container/cpu-ram.yaml

大约 30 秒后,我收到以下消息:

Unable to connect to the server: dial tcp 172.17.0.1:4321: i/o timeout

我在网络上尝试了很多建议(包括在 Stack Overflow 上),但无法弄清楚。我在 Google Cloud Platform 上使用 Google Cloud Shell 并尝试设置 Kubernetes(通过其网站上的官方 Kubernetes 指南)。这是gcloud info的输出:

Google Cloud SDK [145.0.0]
Platform: [Linux, x86_64]
Python Version: [2.7.9 (default, Jun 29 2016, 13:08:31)  [GCC 4.9.2]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]
Installation Root: [/google/google-cloud-sdk]
Installed Components:
  kubectl: []
  app-engine-python: [1.9.50]
  pubsub-emulator: [2017.02.07]
  gsutil-nix: [4.18]
  gsutil: [4.22]
  cloud-datastore-emulator: [1.2.1]
    disable_update_check: [True]
  app-engine-java: [1.9.49]
  gcloud: []
  core: [2017.02.21]
  datalab: [20170215]
  gcloud-deps: [2017.02.21]
  beta: [2016.01.12]
  bq: [2.0.24]
  alpha: [2016.01.12]
  datalab-nix: [20170105]
  core-nix: [2016.11.07]
  app-engine-go-linux-x86_64: [1.9.50]
  app-engine-go: []
  app-engine-php: [ ]
  gcloud-deps-linux-x86_64: [2017.02.21]
  gcd-emulator: [v1beta3-1.0.0]
  kubectl-linux-x86_64: [1.5.2]
  bq-nix: [2.0.24]
System PATH: [/google/google-cloud-sdk/bin:/usr/local/nvm/versions/node/v6.9.2/bin:/home/_removed_/gopath/bin:/google/gopath/bin:/usr/local/go/bin:/gradle-2.12/bin:/apache-maven-3.3.9/bin:/google/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/google/go_appengine:/google/google_appengine]
Cloud SDK on PATH: [True]
Kubectl on PATH: [/google/google-cloud-sdk/bin/kubectl]

WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
  /google/google_appengine/endpointscfg.py
  /google/go_appengine/dev_appserver.py
  /google/google_appengine/dev_appserver.py
  /google/go_appengine/endpointscfg.py

Installation Properties: [/google/google-cloud-sdk/properties]
User Config Directory: [/tmp/tmp.XKaUThqtJm]
Active Configuration Name: [cloudshell-29694]
Active Configuration Path: [/tmp/tmp.XKaUThqtJm/configurations/config_cloudshell-29694]

Account: [_removed_@gmail.com]
Project: [_removed_]

Current Properties:
  [metrics]
    environment: [devshell]
  [core]
    check_gce_metadata: [False]
    project: [_removed_]
    account: [_removed_@gmail.com]
    disable_usage_reporting: [False]
  [compute]
    region: [us-central1]
    gce_metadata_read_timeout_sec: [5]
    zone: [us-central1-b]
  [component_manager]
    disable_update_check: [True]

Logs Directory: [/tmp/tmp.XKaUThqtJm/logs]
Last Log File: [/tmp/tmp.XKaUThqtJm/logs/2017.02.27/21.51.45.088860.log]

【问题讨论】:

  • 您能否提供有关您如何配置集群的更多信息?您可以编辑您的问题以使其可见。
  • @AntoineCotten 在这篇文章中提到的命令之前我没有运行任何命令。我没有“提供”任何东西。我刚刚登录到 Google Cloud Shell 并运行了上面这篇文章中提到的命令。为什么 kubectl create 命令不起作用?
  • 哦,原来如此。有关详细信息,请参阅我的答案。

标签: kubernetes google-cloud-platform google-kubernetes-engine google-cloud-shell


【解决方案1】:

您正在尝试在不存在的集群中安排Pod。在创建资源之前,您需要配置底层集群。

我建议您阅读https://k8s.io 的文档,以了解 Kubernetes 及其构建块。该文档也是了解如何配置 Kubernetes 集群的好地方。在 Google Cloud 上,这非常简单。

【讨论】:

  • 通过您的信息,我能够在 Google Cloud Platform 上设置 Kubernetes 集群。非常感谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-09-03
  • 2022-06-20
  • 1970-01-01
  • 2017-09-08
  • 1970-01-01
  • 2020-08-26
  • 2020-10-23
相关资源
最近更新 更多