1

我是 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 中看到了集群,并看到了 pod、部署等。但是当我执行以下操作时

$ 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"

是什么赋予了?

4

1 回答 1

1

您当前的上下文是sandbox,尝试使用kubectl或直接更改当前上下文~/.kube/config

$ kubectl config get-contexts
$ kubectl config use-context me@company.com@sandbox.us-east-1.eksctl.io
于 2021-02-04T23:32:19.933 回答