Reduce the number of external API calls
We have recently started to have some API calls throttled (to cloudformation mostly).
Work done as part of https://github.com/weaveworks/eksctl/issues/2174 has likely contributed heavily to this, but it has also been casually noticed that we are perhaps making many more calls than we need to, and this has been made opaque in general code sprawl.
This issue is about optimising our code to keep API calls to a minimum. (This is likely a large task, and will require some refactoring. Break into smaller chunks if needed.)
I'm going to investigate the cloudformation calls around eksctl get clusters first as this appears to cause a lot of throttling
for 16 EKS clusters we issue 44 DescribeStack calls to cloudformation. This is most likely the cause of the throttling:
./eksctl get clusters
[ℹ] eksctl version 0.37.0-dev+66708d31.2021-01-14T16:08:13Z
[ℹ] using region us-west-2
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: 5afb05e4-c9fe-44f4-b526-2c5066392088) from cloudformation/DescribeStacks - will retry after delay of 925.223147ms
[ℹ] DescribeCount: 44
PR to address this: https://github.com/weaveworks/eksctl/pull/3073
a lot of throttling during create/delete nodegroup
./eksctl33 create nodegroup -f cluster.yaml
[ℹ] eksctl version 0.33.0
[ℹ] using region us-west-2
[ℹ] will use version 1.18 for new nodegroup(s) based on control plane version
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: 95edf075-631b-4908-82d1-af199846011a) from cloudformation/DescribeStacks - will retry after delay of 522.72417ms
[ℹ] nodegroup "spot-managed-node-group" present in the cluster, but missing from the given config
[ℹ] nodegroup "ng-managed" present in the cluster, but missing from the given config
[ℹ] nodegroup "ng-c292c102" present in the cluster, but missing from the given config
[ℹ] 4 existing nodegroup(s) (ng-c292c102,ng-managed,spot-managed-node-group,spot-managed-node-group-2) will be excluded
[ℹ] 2 sequential tasks: { fix cluster compatibility, no tasks }
[ℹ] checking cluster stack for missing resources
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: 5f98052f-c5d6-4472-98ed-c26e217ca587) from cloudformation/DescribeStacks - will retry after delay of 594.329443ms
[ℹ] cluster stack has all required resources
[ℹ] no tasks
[✔] created 0 nodegroup(s) in cluster "jk"
[✔] created 0 managed nodegroup(s) in cluster "jk"
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: 88f6ddf9-d1b4-4756-b455-715e774b2030) from cloudformation/DescribeStacks - will retry after delay of 760.9655ms
[ℹ] checking security group configuration for all nodegroups
[ℹ] all nodegroups have up-to-date configuration
./eksctl delete nodegroup -f cluster.yaml
[ℹ] eksctl version 0.38.0-dev+16e9c8ef.2021-01-27T14:45:31Z
[ℹ] using region us-west-2
[ℹ] comparing 0 nodegroups defined in the given config ("cluste.yaml") against remote state
[ℹ] 1 nodegroup (spot-managed-node-group) was included (based on the include/exclude rules)
[ℹ] (plan) would drain 1 nodegroup(s) in cluster "jk"
[ℹ] (plan) would delete 1 nodegroups from cluster "jk"
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: 3852bfd0-6782-4f28-9981-64743043e04e) from cloudformation/DescribeStacks - will retry after delay of 961.154192ms
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: bc3bdc76-cd9a-4d57-b434-e626cb35d88a) from cloudformation/DescribeStacks - will retry after delay of 972.906537ms
[ℹ] (plan) 1 task: { delete unowned nodegroup "spot-managed-node-group" }
[ℹ] (plan) would delete 0 nodegroups from auth ConfigMap in cluster "jk"
[✔] (plan) would have deleted 1 nodegroup(s) from cluster "jk"
[!] no changes were applied, run again with '--approve' to apply the changes
(log-remaining-stacks → origin {6} ?:2 ✗) eksctl ./eksctl delete nodegroup -f cluste.yaml --approve
[ℹ] eksctl version 0.38.0-dev+16e9c8ef.2021-01-27T14:45:31Z
[ℹ] using region us-west-2
[ℹ] comparing 0 nodegroups defined in the given config ("cluste.yaml") against remote state
[ℹ] 1 nodegroup (spot-managed-node-group) was included (based on the include/exclude rules)
[ℹ] will drain 1 nodegroup(s) in cluster "jk"
[!] no nodes found in nodegroup "spot-managed-node-group" (label selector: "alpha.eksctl.io/nodegroup-name=spot-managed-node-group")
[ℹ] will delete 1 nodegroups from cluster "jk"
[!] retryable error (Throttling: Rate exceeded
status code: 400, request id: fdb778b4-a858-4bec-80c1-4b57055806e4) from cloudformation/DescribeStacks - will retry after delay of 604.961677ms
a lot of throttling during
create/delete nodegroup./eksctl33 create nodegroup -f cluster.yaml [ℹ] eksctl version 0.33.0 [ℹ] using region us-west-2 [ℹ] will use version 1.18 for new nodegroup(s) based on control plane version [!] retryable error (Throttling: Rate exceeded status code: 400, request id: 95edf075-631b-4908-82d1-af199846011a) from cloudformation/DescribeStacks - will retry after delay of 522.72417ms [ℹ] nodegroup "spot-managed-node-group" present in the cluster, but missing from the given config [ℹ] nodegroup "ng-managed" present in the cluster, but missing from the given config [ℹ] nodegroup "ng-c292c102" present in the cluster, but missing from the given config [ℹ] 4 existing nodegroup(s) (ng-c292c102,ng-managed,spot-managed-node-group,spot-managed-node-group-2) will be excluded [ℹ] 2 sequential tasks: { fix cluster compatibility, no tasks } [ℹ] checking cluster stack for missing resources [!] retryable error (Throttling: Rate exceeded status code: 400, request id: 5f98052f-c5d6-4472-98ed-c26e217ca587) from cloudformation/DescribeStacks - will retry after delay of 594.329443ms [ℹ] cluster stack has all required resources [ℹ] no tasks [✔] created 0 nodegroup(s) in cluster "jk" [✔] created 0 managed nodegroup(s) in cluster "jk" [!] retryable error (Throttling: Rate exceeded status code: 400, request id: 88f6ddf9-d1b4-4756-b455-715e774b2030) from cloudformation/DescribeStacks - will retry after delay of 760.9655ms [ℹ] checking security group configuration for all nodegroups [ℹ] all nodegroups have up-to-date configuration./eksctl delete nodegroup -f cluster.yaml [ℹ] eksctl version 0.38.0-dev+16e9c8ef.2021-01-27T14:45:31Z [ℹ] using region us-west-2 [ℹ] comparing 0 nodegroups defined in the given config ("cluste.yaml") against remote state [ℹ] 1 nodegroup (spot-managed-node-group) was included (based on the include/exclude rules) [ℹ] (plan) would drain 1 nodegroup(s) in cluster "jk" [ℹ] (plan) would delete 1 nodegroups from cluster "jk" [!] retryable error (Throttling: Rate exceeded status code: 400, request id: 3852bfd0-6782-4f28-9981-64743043e04e) from cloudformation/DescribeStacks - will retry after delay of 961.154192ms [!] retryable error (Throttling: Rate exceeded status code: 400, request id: bc3bdc76-cd9a-4d57-b434-e626cb35d88a) from cloudformation/DescribeStacks - will retry after delay of 972.906537ms [ℹ] (plan) 1 task: { delete unowned nodegroup "spot-managed-node-group" } [ℹ] (plan) would delete 0 nodegroups from auth ConfigMap in cluster "jk" [✔] (plan) would have deleted 1 nodegroup(s) from cluster "jk" [!] no changes were applied, run again with '--approve' to apply the changes (log-remaining-stacks → origin {6} ?:2 ✗) eksctl ./eksctl delete nodegroup -f cluste.yaml --approve [ℹ] eksctl version 0.38.0-dev+16e9c8ef.2021-01-27T14:45:31Z [ℹ] using region us-west-2 [ℹ] comparing 0 nodegroups defined in the given config ("cluste.yaml") against remote state [ℹ] 1 nodegroup (spot-managed-node-group) was included (based on the include/exclude rules) [ℹ] will drain 1 nodegroup(s) in cluster "jk" [!] no nodes found in nodegroup "spot-managed-node-group" (label selector: "alpha.eksctl.io/nodegroup-name=spot-managed-node-group") [ℹ] will delete 1 nodegroups from cluster "jk" [!] retryable error (Throttling: Rate exceeded status code: 400, request id: fdb778b4-a858-4bec-80c1-4b57055806e4) from cloudformation/DescribeStacks - will retry after delay of 604.961677ms
I looked into this, I don't think we can reduce the number of Cloudformation calls at the moment. We get the stack for each nodegroup as we need to look into it to see if it's a nodegroups thats Managed or not, you can't detect this from the name. An alterntive would be to lookup in Kubernetes, but this would lean away from our approach of treating Cloudformation as the source of truth so I don't think its a good idea.
Gah that's a bummer 😞 thanks for keeping on top of this.
Can you reduce the no. of calls? i.e. exponential back off, queuing, etc to reduce the potential of encountering throttling? Users are getting impacted by this issue?
Can you reduce the no. of calls? i.e. exponential back off, queuing, etc to reduce the potential of encountering throttling? Users are getting impacted by this issue?
@NaranKPatel we do have some commands where we can reduce the number of AWS API calls. Can you help us with the specific commands you're facing this issue for so we can prioritise them?
Can you reduce the no. of calls? i.e. exponential back off, queuing, etc to reduce the potential of encountering throttling? Users are getting impacted by this issue?
@NaranKPatel we do have some commands where we can reduce the number of AWS API calls. Can you help us with the specific commands you're facing this issue for so we can prioritise them?
From a comment from another user in the community Slack, it appears that it's for create iamserviceaccounts, upgrade cluster and create cluster, among other commands.
@cPu1 create iamserviceaccounts incurs huge number of then proceeding cloudformation/DescribeStacks calls, to the point where it breaks any related changes and makes a mess of the cluster that needs 2+ hours of work to clean-up! I'm going through and looking at further commands but 3 you've listed (create iamserviceaccounts, upgrade cluster and create cluster) generate a lot proceeding describe calls. Basically any command that follows this behavior needs to be mitigated as mentioned above. I believe the problem is worse the larger the number of distinct/unique workloads, non-prod where we and likely everyone cost optimizes. The larger clusters of distinct workloads don't appear to encounter this problem as much, anyone that tries to simplify and consolidate into multi-tenant clusters may run into this too!
Is it possible to reduce the loglevel for retryable errors in some way?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
eksctl create iamserviceaccount
Tracking through a create iamserviceaccount calls in-order:
- EKS
DescribeControlPlane- to fetch the cluster status before proceeding - STS
GetCallerIdentityRequest- to fetch token for a in-memory kubeconfig - If more than 15 seconds have passed since
1.we refresh the cluster status - IAM
GetOpenIDConnectProvider- to check the OIDC provider exists (IRSA doesn't work without an associated OIDC) - Then in parallel (this might be the cause of a lot of throttling), for each service account:
a. CloudFormation
CreateStack- to create the IAM Role b. CloudFormationDescribeStack- to check if the stack is finished creating c. repeatb.initially every 15-20 seconds until stack is complete, but the time increases with an exponential backoff. We use AWS SDK logic for this loop: https://github.com/aws/aws-sdk-go/blob/ec72eb19318629ccc23ae2a5a43017fd89818089/aws/request/waiter.go#L154-L212 - Create/Annotate kubernetes service account
I tried creating 16 serviceaccounts at once, all that required IAM roles to be created:
2021-10-19 11:38:30 [ℹ] eksctl version 0.71.0-dev+f4fbe1c8.2021-10-19T10:24:46Z
2021-10-19 11:38:30 [ℹ] using region us-west-2
2021-10-19 11:38:36 [ℹ] 1 existing iamserviceaccount(s) (default/some-app) will be excluded
2021-10-19 11:38:36 [ℹ] 16 iamserviceaccounts (backend-apps/cache-access, backend-apps/s3-reade1, backend-apps/s3-reade2, backend-apps/s3-reade3, backend-apps/s3-reade4, backend-apps/s3-reade5, backend-apps/s3-reade6, backend-apps/s3-reade7, cert-manager/cert-manager, ci-cd/build-service, kube-system/autoscaler-service, kube-system/aws-load-balancer-controller, kube-system/cluster-autoscaler, kube-system/ebs-csi-controller-sa, kube-system/efs-csi-controller-sa, kube-system/external-dns) were included (based on the include/exclude rules)
2021-10-19 11:38:36 [ℹ] 1 iamserviceaccount (default/some-app) was excluded (based on the include/exclude rules)
2021-10-19 11:38:36 [!] serviceaccounts that exist in Kubernetes will be excluded, use --override-existing-serviceaccounts to override
2021-10-19 11:38:36 [ℹ]
16 parallel tasks: {
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade1",
create serviceaccount "backend-apps/s3-reade1",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade2",
create serviceaccount "backend-apps/s3-reade2",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade3",
create serviceaccount "backend-apps/s3-reade3",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade4",
create serviceaccount "backend-apps/s3-reade4",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade5",
create serviceaccount "backend-apps/s3-reade5",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade6",
create serviceaccount "backend-apps/s3-reade6",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/s3-reade7",
create serviceaccount "backend-apps/s3-reade7",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/aws-load-balancer-controller",
create serviceaccount "kube-system/aws-load-balancer-controller",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/ebs-csi-controller-sa",
create serviceaccount "kube-system/ebs-csi-controller-sa",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/efs-csi-controller-sa",
create serviceaccount "kube-system/efs-csi-controller-sa",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/external-dns",
create serviceaccount "kube-system/external-dns",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "cert-manager/cert-manager",
create serviceaccount "cert-manager/cert-manager",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/cluster-autoscaler",
create serviceaccount "kube-system/cluster-autoscaler",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "ci-cd/build-service",
create serviceaccount "ci-cd/build-service",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "backend-apps/cache-access",
create serviceaccount "backend-apps/cache-access",
},
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/autoscaler-service",
create serviceaccount "kube-system/autoscaler-service",
}
}
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-kube-system-autoscaler-service"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade1"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-kube-system-cluster-autoscaler"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade2"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade5"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-cache-access"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-ci-cd-build-service"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-kube-system-efs-csi-controller-sa"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-kube-system-external-dns"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade4"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade3"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-cert-manager-cert-manager"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-kube-system-ebs-csi-controller-sa"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade6"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2021-10-19 11:38:36 [ℹ] building iamserviceaccount stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade7"
2021-10-19 11:38:36 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade4"
2021-10-19 11:38:36 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade4"
2021-10-19 11:38:36 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade2"
2021-10-19 11:38:36 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade2"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade5"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade5"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-ci-cd-build-service"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-ci-cd-build-service"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-cache-access"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-cache-access"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade7"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade7"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade6"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-cert-manager-cert-manager"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade6"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-cert-manager-cert-manager"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade3"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade3"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-kube-system-efs-csi-controller-sa"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-efs-csi-controller-sa"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-kube-system-external-dns"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-external-dns"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade1"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade1"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-kube-system-autoscaler-service"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-autoscaler-service"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-kube-system-cluster-autoscaler"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-cluster-autoscaler"
2021-10-19 11:38:37 [ℹ] deploying stack "eksctl-jk-addon-iamserviceaccount-kube-system-ebs-csi-controller-sa"
2021-10-19 11:38:37 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-ebs-csi-controller-sa"
2021-10-19 11:38:53 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2021-10-19 11:38:53 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-cert-manager-cert-manager"
2021-10-19 11:38:54 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-efs-csi-controller-sa"
2021-10-19 11:38:54 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade4"
2021-10-19 11:38:54 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-ebs-csi-controller-sa"
2021-10-19 11:38:54 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade2"
2021-10-19 11:38:55 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-external-dns"
2021-10-19 11:38:55 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade3"
2021-10-19 11:38:55 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade7"
2021-10-19 11:38:55 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade6"
2021-10-19 11:38:56 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade5"
2021-10-19 11:38:56 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-ci-cd-build-service"
2021-10-19 11:38:56 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-cluster-autoscaler"
2021-10-19 11:38:56 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-cache-access"
2021-10-19 11:38:56 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-autoscaler-service"
2021-10-19 11:38:56 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade1"
2021-10-19 11:39:09 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2021-10-19 11:39:10 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-efs-csi-controller-sa"
2021-10-19 11:39:10 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade4"
2021-10-19 11:39:11 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-cert-manager-cert-manager"
2021-10-19 11:39:11 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade7"
2021-10-19 11:39:11 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-ci-cd-build-service"
2021-10-19 11:39:11 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade3"
2021-10-19 11:39:12 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-external-dns"
2021-10-19 11:39:12 [ℹ] created serviceaccount "backend-apps/s3-reade4"
2021-10-19 11:39:12 [ℹ] created serviceaccount "backend-apps/s3-reade7"
2021-10-19 11:39:12 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-cluster-autoscaler"
2021-10-19 11:39:12 [ℹ] created serviceaccount "ci-cd/build-service"
2021-10-19 11:39:12 [ℹ] created serviceaccount "backend-apps/s3-reade3"
2021-10-19 11:39:13 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade1"
2021-10-19 11:39:13 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade5"
2021-10-19 11:39:13 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-autoscaler-service"
2021-10-19 11:39:14 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-ebs-csi-controller-sa"
2021-10-19 11:39:14 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade2"
2021-10-19 11:39:14 [ℹ] created serviceaccount "backend-apps/s3-reade1"
2021-10-19 11:39:14 [!] retryable error (Throttling: Rate exceeded
status code: 400, request id: 11431fe7-5cb6-4393-b21c-7bdf5f7bc534) from cloudformation/DescribeStacks - will retry after delay of 6.2035514s
2021-10-19 11:39:14 [ℹ] created serviceaccount "backend-apps/s3-reade5"
2021-10-19 11:39:15 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-s3-reade6"
2021-10-19 11:39:15 [ℹ] created serviceaccount "backend-apps/s3-reade2"
2021-10-19 11:39:16 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-backend-apps-cache-access"
2021-10-19 11:39:16 [ℹ] created serviceaccount "backend-apps/s3-reade6"
2021-10-19 11:39:17 [ℹ] created serviceaccount "backend-apps/cache-access"
2021-10-19 11:39:21 [ℹ] created serviceaccount "kube-system/ebs-csi-controller-sa"
2021-10-19 11:39:26 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2021-10-19 11:39:27 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-efs-csi-controller-sa"
2021-10-19 11:39:27 [ℹ] created serviceaccount "kube-system/aws-load-balancer-controller"
2021-10-19 11:39:28 [ℹ] created serviceaccount "kube-system/efs-csi-controller-sa"
2021-10-19 11:39:29 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-cluster-autoscaler"
2021-10-19 11:39:30 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-cert-manager-cert-manager"
2021-10-19 11:39:30 [ℹ] created serviceaccount "kube-system/cluster-autoscaler"
2021-10-19 11:39:30 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-autoscaler-service"
2021-10-19 11:39:31 [ℹ] created serviceaccount "cert-manager/cert-manager"
2021-10-19 11:39:31 [ℹ] waiting for CloudFormation stack "eksctl-jk-addon-iamserviceaccount-kube-system-external-dns"
2021-10-19 11:39:32 [ℹ] created serviceaccount "kube-system/autoscaler-service"
2021-10-19 11:39:32 [ℹ] created serviceaccount "kube-system/external-dns"
This only resulted in a couple of throttling warnings. I tried re-running this but including it as part of cluster creation, and saw the same behaviour.
Actions
I don't think we can reduce the number of calls, but we could reduce the number of concurrent calls by sequentially creating the IRSA's instead of creating them in parallel. This would increase the time it takes for the command to complete by a lot however. I think for the moment this isn't enough of a pain for users to worth changing.
eksctl upgrade cluster
Tracking through a upgrade cluster calls in-order:
- EKS
DescribeControlPlane- to fetch the cluster status before proceeding - Duplication of
1.EKSDescribeControlPlane- to fetch the cluster status before proceeding a. this could probably be refactored out - CloudFormation
ListStacks- to see if a stack exists for the cluster - CloudFormation
DescribeStack- to check the cluster stack to see if the cluster is "owned" or "unowned" - CloudFormation
DescribeStack- to fetch the clusters VPC state. Encase we need to migrate the stack from a legacy version - EKS
UpdateClusterVersionto trigger the update - Poll EKS
DescribeUpdateuntil the upgrade it complete a. repeat initially every 15-20 seconds until desired outcome occurs, but the time increases with an exponential backoff. We use AWS SDK logic for this loop: https://github.com/aws/aws-sdk-go/blob/ec72eb19318629ccc23ae2a5a43017fd89818089/aws/request/waiter.go#L154-L212 - STS
GetCallerIdentityRequest- to fetch token for a in-memory kubeconfig, we poll kubernetes to check its also up-to-date (unsure why :thinking: ) - EKS
DescribeControlPlane- to fetch the cluster status - CloudFormation
GetTemplate- fetch the cluster tempalte, we check if the stack needs updating. If it does then a. CloudFormationUpdateStack- to update the stack b. CloudFormationDescribeStack- to check if the stack is updating creating c. repeat b. initially every 15-20 seconds until stack is complete, but the time increases with an exponential backoff. We use AWS SDK logic for this loop: https://github.com/aws/aws-sdk- go/blob/ec72eb19318629ccc23ae2a5a43017fd89818089/aws/request/waiter.go#L154-L212 - CloudFormation
ListStacks - For each Nodegroup: CloudFormation
DescribeStack- we do this to check each nodegroup is still compatible with the cluster https://github.com/weaveworks/eksctl/blob/d18a30882ce9c4f5dcffab76ac4a4646a6a556b1/pkg/eks/nodegroup_service.go#L244
I'm not really sure what's going on here? What's the point in reducing a number of calls if it's an AWS issue and it still succeeds after enough retries?
@NaranKPatel
to the point where it breaks any related changes and makes a mess of the cluster that needs 2+ hours of work to clean-up!
Have you raised that with AWS? What was the answer? What was the failure scenario? I.e. some calls failed, what was number of retries? How much time the retries run?
I'm not really sure what's going on here? What's the point in reducing a number of calls if it's an AWS issue and it still succeeds after enough retries?
For us we are just trying to reduce the number of duplicate API calls we make. When this issue was originally opened we had a lot of unnecessary API calls due to poor code. We've been cleaning it up as part of this. Your right though that we will still have to do a certain amount of calls that will most likely trigger the re-try logic
Thanks. It was not clear to me that from the first to the last entry there was a lot of work done! On the other hand I have come to this issue from #2965 , which kind of means: "we won't add more functionality if it increases a number of API calls". Which was kinda counter-intuitive to me...
Thanks. It was not clear to me that from the first to the last entry there was a lot of work done! On the other hand I have come to this issue from #2965 , which kind of means: "we won't add more functionality if it increases a number of API calls". Which was kinda counter-intuitive to me...
I don't think that was the intended message, but more that we have to consider this carefully when editing existing commands. If eksctl get clusters went from 10 api to fetch the 10 existing clusters, to 30 or 40 users might have a noticeably degraded UX
closing for now, feel free to re-open if anybody hits any new throttling issues