访问命名空间时的 Kubectl 错误
Kubectl Error when accessing Namespaces
我正在尝试 Tectonic Kubernetes 沙箱设置并根据他们的文档:
https://coreos.com/tectonic/docs/latest/tutorials/first-app.html
我确实下载了 kubectl 和相应的 kube-config 文件,但是当我尝试使用以下命令获取命名空间时:
kubectl get namespaces
我收到以下错误:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
这是什么?它从哪里获取这个端口 locahost:8080?
编辑:
Joe-MacBook-Pro:~ joe$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
Joe-MacBook-Pro:~ joe$
我缺少有关您的设置的一些详细信息,但问题基本上很清楚 - 您没有连接到集群。
你应该有一个包含集群连接信息的 kubeconfig 文件,即上下文,我假设如果你 运行 kubectl config view
你什么也得不到。
我在 windows 使用 git bash,如果我 运行 我得到相同的命令:
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
列出您的选项,这非常简单,但如果不管理,请参阅文档。
我正在尝试 Tectonic Kubernetes 沙箱设置并根据他们的文档:
https://coreos.com/tectonic/docs/latest/tutorials/first-app.html
我确实下载了 kubectl 和相应的 kube-config 文件,但是当我尝试使用以下命令获取命名空间时:
kubectl get namespaces
我收到以下错误:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
这是什么?它从哪里获取这个端口 locahost:8080?
编辑:
Joe-MacBook-Pro:~ joe$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
Joe-MacBook-Pro:~ joe$
我缺少有关您的设置的一些详细信息,但问题基本上很清楚 - 您没有连接到集群。
你应该有一个包含集群连接信息的 kubeconfig 文件,即上下文,我假设如果你 运行 kubectl config view
你什么也得不到。
我在 windows 使用 git bash,如果我 运行 我得到相同的命令:
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
列出您的选项,这非常简单,但如果不管理,请参阅文档。