Kubernetes:无法连接到服务器

时间:2017-02-28 04:43:36

标签: 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秒后,我收到此消息:

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

我在网上尝试过很多建议(包括Stack Overflow),但无法弄明白。我在Google云端平台上使用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]

1 个答案:

答案 0 :(得分:2)

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

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