访问命名空间时出现Kubectl错误

时间:2017-08-29 09:37:04

标签: kubernetes tectonic-coreos

我正在尝试使用Tectonic Kubernetes沙箱设置并根据他们的文档:

https://coreos.com/tectonic/docs/latest/tutorials/first-app.html

我确实下载了kubectl和相应的kube-config文件,但是当我尝试使用以下命令获取命名空间时:

Fruit

我收到以下错误:

kubectl get namespaces
这是什么?从哪里获取这个港口locahost:8080?

编辑:

The connection to the server localhost:8080 was refused - did you specify the right host or port?

1 个答案:

答案 0 :(得分:2)

我缺少有关您的设置的一些细节,但问题基本上是清楚的 - 您没有连接到群集。

你应该有一个包含集群连接信息的kubeconfig文件,即上下文,我假设如果你运行kubectl config view,你将什么也得不到。

我在使用git bash的Windows上,如果我运行相同的命令:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://platform-svc-integration.net
  name: svc-integration
contexts:
- context:
    cluster: svc-integration
    user: svc-integration-admin
  name: svc-integration-system
current-context: svc-integration-system
kind: Config
preferences: {}
users:
- name: svc-integration-admin
  user:
    client-certificate: <path>/admin/admin.crt
    client-key: <path>/admin/admin.key

基本上我想说的是你需要配置你的上下文,首先要做kubectl config --help列出你的选项,这很简单但是如果不管理就参考文档。