Search code examples
amazon-web-serviceskubernetesamazon-ekseksctl

How to resolve error while creating the cluster using eksctl in AWS


I am trying to create a cluster in AWS us-east-1 region for a user account of my root account.But while trying to create the same i am getting the following issues

  [ℹ]  eksctl version 0.22.0
  [ℹ]  using region us-east-1
  [ℹ]  subnets for us-east-1a - public:192.168.0.0/19 private:192.168.64.0/19
  [ℹ]  subnets for us-east-1b - public:192.168.32.0/19 private:192.168.96.0/19
  [ℹ]  using Kubernetes version 1.16
  [ℹ]  creating EKS cluster "in28minutes-cluster" in "us-east-1" region with managed nodes
  [ℹ]  will create 2 separate CloudFormation stacks for cluster itself and the initial managed nodegroup
  [ℹ]  if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-east-1 --cluster=in28minutes-cluster'
  [ℹ]  CloudWatch logging will not be enabled for cluster "in28minutes-cluster" in "us-east-1"
  [ℹ]  you can enable it with 'eksctl utils update-cluster-logging --region=us-east-1 --cluster=in28minutes-cluster'
  [ℹ]  Kubernetes API endpoint access will use default of {publicAccess=true, privateAccess=false} for cluster "in28minutes-cluster" in "us-east-1"
  [ℹ]  2 sequential tasks: { create cluster control plane "in28minutes-cluster", 2 sequential sub-tasks: { no tasks, create managed nodegroup "in28minutes-cluster-node-group" } }
  [ℹ]  building cluster stack "eksctl-in28minutes-cluster-cluster"
  [ℹ]  deploying stack "eksctl-in28minutes-cluster-cluster"
  [✖]  unexpected status "ROLLBACK_IN_PROGRESS" while waiting for CloudFormation stack "eksctl-in28minutes-cluster-cluster"
  [ℹ]  fetching stack events in attempt to troubleshoot the root cause of the failure
  [✖]  AWS::EC2::SubnetRouteTableAssociation/RouteTableAssociationPrivateUSEAST1B: CREATE_FAILED – "Resource creation cancelled"
  [✖]  AWS::EC2::Route/PublicSubnetRoute: CREATE_FAILED – "Resource creation cancelled"
  [✖]  AWS::EC2::SubnetRouteTableAssociation/RouteTableAssociationPrivateUSEAST1A: CREATE_FAILED – "Resource creation cancelled"
  [✖]  AWS::EC2::NatGateway/NATGateway: CREATE_FAILED – "Resource creation cancelled"
  [✖]  AWS::EC2::SubnetRouteTableAssociation/RouteTableAssociationPublicUSEAST1A: CREATE_FAILED – "Resource creation cancelled"
  [✖]  AWS::EC2::SubnetRouteTableAssociation/RouteTableAssociationPublicUSEAST1B: CREATE_FAILED – "Resource creation cancelled"
  [✖]  AWS::EKS::Cluster/ControlPlane: CREATE_FAILED – "User: arn:aws:iam::750121092648:user/HR is not authorized to perform: eks:CreateCluster on resource: arn:aws:eks:us-east-1:750121092648:cluster/in28minutes-cluster (Service: AmazonEKS; Status Code: 403; Error Code: AccessDeniedException; Request ID: 290ba47a-6423-4ce7-bd25-c429e1f69ea8)"
  [!]  1 error(s) occurred and cluster hasn't been created properly, you may wish to check CloudFormation console
  [ℹ]  to cleanup resources, run 'eksctl delete cluster --region=us-east-1 --name=in28minutes-cluster'
  [✖]  waiting for CloudFormation stack "eksctl-in28minutes-cluster-cluster": ResourceNotReady: failed waiting for successful resource state
  Error: failed to create cluster "in28minutes-cluster"

This is the command i am using to create the cluster

create cluster --name in28minutes-cluster --nodegroup-name in28minutes-cluster-node-group  --node-type t2.medium --nodes 3 --nodes-min 3 --nodes-max 7 --managed --asg-access --zones=us-east-1a,us-east-1b

I also have clouformation role for my user account

enter image description here

Please help me to resolve this issue , I am new to aws kubernetes


Solution

  • This line from your logs

    [✖]  AWS::EKS::Cluster/ControlPlane: CREATE_FAILED – "User: arn:aws:iam::750121092648:user/HR is not authorized to perform: eks:CreateCluster on resource: arn:aws:eks:us-east-1:750121092648:cluster/in28minutes-cluster (Service: AmazonEKS; Status Code: 403; Error Code: AccessDeniedException; Request ID: 290ba47a-6423-4ce7-bd25-c429e1f69ea8)"
    

    seems to suggest that the user HR doesn't have all the necessary EKS permissions. Try (temporarily) attaching the HR user the AWS-managed AdministratorAccess policy. Then, if this resolves the issue, narrow it down to only EKS-related permissions.