Ale*_*sko 2 kubernetes kubectl
我有~/.kube/config以下内容:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: REDACTED
server: https://REDACTED.yl4.us-east-1.eks.amazonaws.com
name: kubernetes-jenkins
- cluster:
certificate-authority-data: REDACTED
server: https://REDACTED.sk1.us-east-1.eks.amazonaws.com
name: kuberntes-dev
contexts:
- context:
cluster: kubernetes-dev
user: aws-dev
name: aws-dev
- context:
cluster: kubernetes-jenkins
user: aws-jenkins
name: aws-jenkins
current-context: aws-dev
kind: Config
preferences: {}
users:
- name: aws-dev
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- token
- -i
- EKS_DEV_CLUSTER
command: heptio-authenticator-aws
env: null
- name: aws-jenkins
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- token
- -i
- EKS_JENKINS_CLUSTER
command: heptio-authenticator-aws
env: null
Run Code Online (Sandbox Code Playgroud)
但是当我尝试时,kubectl cluster-info我得到:
Kubernetes master is running at http://localhost:8080
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Run Code Online (Sandbox Code Playgroud)
据我了解我的 kubeconfig 有问题,但我不明白到底是什么。我也试图找到任何相关的问题,但没有运气。
你能给我建议吗?
谢谢。
您需要选择要使用的上下文。有关如何在此处使用多个用户的多个集群的更多信息。
本质上,您可以查看当前上下文(针对当前配置的集群)
$ kubectl config current-context
Run Code Online (Sandbox Code Playgroud)
要查看,配置的所有集群:
$ kubectl config get-clusters
Run Code Online (Sandbox Code Playgroud)
并选择您的集群:
$ kubectl config use-context <cluster-name>
Run Code Online (Sandbox Code Playgroud)
如果您在~/kube/config文件中定义了不同的用户,则可以选择为每个集群设置不同的用户。
| 归档时间: |
|
| 查看次数: |
1140 次 |
| 最近记录: |