如何设置 Kubectl 与之通信的 EKS 服务器?
How to set EKS server for kubectl to talk to?
我是 Kubernetes 的新手,正在关注一些设置上下文的示例。现在我似乎无法在我的服务器上获取任何对象,或者我正在与错误的服务器通信。我明白了...
$ kubectl config view
apiVersion: v1
clusters:
- cluster:
server: ""
name: sandbox
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://redacted.gr7.us-east-1.eks.amazonaws.com
name: sandbox.us-east-1.eksctl.io
contexts:
- context:
cluster: sandbox.us-east-1.eksctl.io
user: me@company.com@sandbox.us-east-1.eksctl.io
name: me@company.com@sandbox.us-east-1.eksctl.io
- context:
cluster: sandbox
namespace: kube-system
user: ""
name: sandbox
current-context: sandbox
kind: Config
preferences: {}
users:
- name: me@company.com@sandbox.us-east-1.eksctl.io
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- token
- -i
- sandbox
command: aws-iam-authenticator
env:
- name: AWS_STS_REGIONAL_ENDPOINTS
value: regional
- name: AWS_DEFAULT_REGION
value: us-east-1
我在 AWS EKS 中看到集群,并看到 pods、部署等。但是当我执行以下操作时
$ kubectl get pods -A
error: the server doesn't have a resource type "pods"
$ kubectl get nodes -A
error: the server doesn't have a resource type "nodes"
什么给了?
您当前的上下文是 sandbox
,请尝试使用 kubectl 或直接在 ~/.kube/config
中更改当前上下文。
$ kubectl config get-contexts
$ kubectl config use-context me@company.com@sandbox.us-east-1.eksctl.io
我是 Kubernetes 的新手,正在关注一些设置上下文的示例。现在我似乎无法在我的服务器上获取任何对象,或者我正在与错误的服务器通信。我明白了...
$ kubectl config view
apiVersion: v1
clusters:
- cluster:
server: ""
name: sandbox
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://redacted.gr7.us-east-1.eks.amazonaws.com
name: sandbox.us-east-1.eksctl.io
contexts:
- context:
cluster: sandbox.us-east-1.eksctl.io
user: me@company.com@sandbox.us-east-1.eksctl.io
name: me@company.com@sandbox.us-east-1.eksctl.io
- context:
cluster: sandbox
namespace: kube-system
user: ""
name: sandbox
current-context: sandbox
kind: Config
preferences: {}
users:
- name: me@company.com@sandbox.us-east-1.eksctl.io
user:
exec:
apiVersion: client.authentication.k8s.io/v1alpha1
args:
- token
- -i
- sandbox
command: aws-iam-authenticator
env:
- name: AWS_STS_REGIONAL_ENDPOINTS
value: regional
- name: AWS_DEFAULT_REGION
value: us-east-1
我在 AWS EKS 中看到集群,并看到 pods、部署等。但是当我执行以下操作时
$ kubectl get pods -A
error: the server doesn't have a resource type "pods"
$ kubectl get nodes -A
error: the server doesn't have a resource type "nodes"
什么给了?
您当前的上下文是 sandbox
,请尝试使用 kubectl 或直接在 ~/.kube/config
中更改当前上下文。
$ kubectl config get-contexts
$ kubectl config use-context me@company.com@sandbox.us-east-1.eksctl.io