Admins-MacBook-Pro:~ Harshin$ kubectl cluster-info
Kubernetes master 运行在 http://localhost:8080

要进一步调试和诊断集群问题,请使用“kubectl cluster-info dump”。
错误:服务器没有资源类型“服务”

我正在关注这个文件

https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html?refid=gs_card

当我尝试在为 amazon eks 配置 kubectl 的第 11 步中测试我的配置时

apiVersion: v1
clusters:
- cluster:
    server: ...
    certificate-authority-data: ....
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: aws
  name: aws
current-context: aws
kind: Config
preferences: {}
users:
- name: aws
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: heptio-authenticator-aws
      args:
        - "token"
        - "-i"
        - "kunjeti"
        # - "-r"
        # - "<role-arn>"
      # env:
        # - name: AWS_PROFILE
        #   value: "<aws-profile>"

最佳答案

将“name: kubernetes”更改为集群的实际名称。

这是我为解决它所做的工作......

1.启用详细以确保正确读取配置文件。



2.修改文件如下:

apiVersion: v1
clusters:
- cluster:
    server: XXXXX
    certificate-authority-data: XXXXX
  name: abc-eks
contexts:
- context:
    cluster: abc-eks
    user: aws
  name: aws
current-context: aws
kind: Config
preferences: {}
users:
- name: aws
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: aws-iam-authenticator
      args:
        - "token"
        - "-i"
        - "abc-eks"
        # - "-r"
        # - "<role-arn>"
      env:
        - name: AWS_PROFILE
          value: "aws"

关于kubernetes - 错误 : the server doesn't have resource type "svc",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51135795/

10-16 17:17