Kubernetes:无法连接到服务器

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

我在这里遵循 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 秒后,我收到此消息:

无法连接到服务器:调用 tcp 172.17.0.1:4321:i/o 超时

我在网络上尝试了很多建议(包括 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: [<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a6f9d4c3cbc9d0c3c2f9e6c1cbc7cfca88c5c9cb" rel="noreferrer noopener nofollow">[email protected]</a>]
Project: [_removed_]

Current Properties:
  [metrics]
    environment: [devshell]
  [core]
    check_gce_metadata: [False]
    project: [_removed_]
    account: [<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c39cb1a6aeacb5a6a79c83a4aea2aaafeda0acae" rel="noreferrer noopener nofollow">[email protected]</a>]
    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]

最佳答案

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

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

关于Kubernetes:无法连接到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42500377/

相关文章:

ubuntu - 将 Kubernetes 网络路由更改为互联网

google-cloud-platform - Dataproc 集群无法初始化

google-app-engine - Google App Engine Flexible 和 Google Container Engine 之间的区别?

mongodb - 副本集配置无效或者我们不是它的成员,在 kubernetes 中运行

kubernetes - GKE - 使用自定义指标的 HPA - 无法获取指标

docker - 使用Docker的Kubernetes,我们是否需要在所有节点(包括Kubernetes主节点)上使用Docker CRI?

windows - 有可靠的方法如何在Windows上运行虚拟化Docker/Kubernetes堆栈吗?

amazon-web-services - 指标服务器:v0.4.2 无法在 AWS kubernetes 集群环境中抓取指标(无法验证证书,不包含任何 IP SAN)

google-cloud-platform - Googleapis.com - 防火墙的 IP 和端口是什么?

node.js - Google 云平台 - 调度程序?