EKS cluster setup error: the server doesn’t have a resource type “services

[root@ip-172-31-26-102 ~]# kubectl cluster-info
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
error: the server doesn't have a resource type "services"
[root@ip-172-31-26-102 ~]# kubectl get svc
error: the server doesn't have a resource type "svc"
[root@ip-172-31-26-102 ~]# kubectl get deploy
error: the server doesn't have a resource type "deploy"
[root@ip-172-31-26-102 ~]# kubectl get nodes
error: the server doesn't have a resource type "nodes"
  • When an Amazon EKS cluster is created, the IAM entity (user or role) that creates the cluster is added to the Kubernetes RBAC authorization table as the administrator (with system:master permissions.
  • Initially, only that IAM user can make calls to the Kubernetes API server using kubectl.
  • If you use the console to create the cluster, you must ensure that the same IAM user credentials are in the AWS SDK credential chain when you are running kubectl commands on your cluster.
  • When you create an Amazon EKS cluster, the IAM entity user or role, such as a federated user that creates the cluster, is automatically granted system:masters permissions in the cluster’s RBAC configuration.

To grant additional AWS users or roles the ability to interact with your cluster, you must edit the aws-auth ConfigMap within Kubernetes.

$ kubectl describe configmap -n kube-system aws-auth
$ kubectl edit -n kube-system configmap/aws-auth
  • To add an IAM user: add the user details to the mapUsers section of the ConfigMap, under data. Add this section if it does not already exist in the file. Each entry supports the following parameters:
    • userarn: The ARN of the IAM user to add.
    • username: The user name within Kubernetes to map to the IAM user. By default, the user name is the ARN of the IAM user.
    • groups: A list of groups within Kubernetes to which the user is mapped to. For more information, see Default Roles and Role Bindings in the Kubernetes documentation.
  • To add an IAM role (for example, for federated users): add the role details to themapRoles section of the ConfigMap, under data. Add this section if it does not already exist in the file. Each entry supports the following parameters:
    • rolearn: The ARN of the IAM role to add.
    • username: The user name within Kubernetes to map to the IAM role. By default, the user name is the ARN of the IAM role.
    • groups: A list of groups within Kubernetes to which the role is mapped. For more information, see Default Roles and Role Bindings in the Kubernetes documentation.
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  mapRoles: |
    - rolearn: arn:aws:iam::555555555555:role/devel-worker-nodes-NodeInstanceRole-74RF4UBDUKL6
      username: system:node:{{EC2PrivateDNSName}}
      groups:
        - system:bootstrappers
        - system:nodes
  mapUsers: |
    - userarn: arn:aws:iam::555555555555:user/admin
      username: admin
      groups:
        - system:masters
    - userarn: arn:aws:iam::111122223333:user/ops-user
      username: ops-user
      groups:
        - system:masters
Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)