question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to deploy EKS cluster

See original GitHub issue

The problem

Deploying a basic example of an EKS cluster fails with LocalStack on local.

The code

The stack comes from the AWS CDK EKS example.

import * as eks from "@aws-cdk/aws-eks"
import * as cdk from "@aws-cdk/core"

export class AwsCdkWithTypescriptFoundationsStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props)

    // provisiong a cluster
    const cluster = new eks.Cluster(this, "hello-eks", {
      version: eks.KubernetesVersion.V1_21,
    })

    // apply a kubernetes manifest to the cluster
    cluster.addManifest("mypod", {
      apiVersion: "v1",
      kind: "Pod",
      metadata: { name: "mypod" },
      spec: {
        containers: [
          {
            name: "hello",
            image: "paulbouwer/hello-kubernetes:1.5",
            ports: [{ containerPort: 8080 }],
          },
        ],
      },
    })
  }
}

Steps to recreate

  1. Add the above code to a TypeScript AWS CDK app
  2. Run the following:
$ cdk synth
$ cdk bootstrap
$ cdk deploy
# ... error 

The error (as far as I can tell) from the docker compose logs:

localstack_1  | 2021-08-11T09:30:04:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::Join': ['', ['aws eks get-token --cluster-name ', {'Ref': 'HelloEKS39C624A1'}, ' --region ', {'Ref': 'AWS::Region'}, ' --role-arn ', {'Fn::GetAtt': ['HelloEKSMastersRole53742E60', 'Arn']}]]}} - Unable to fetch details for resource "HelloEKS39C624A1" (attribute "Ref")
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.services.cloudformation.cloudformation_api: Executing change set "cdk-deploy-change-set" for stack "AwsCdkWithTypescriptFoundationsStack" with 37 resources ...
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.utils.cloudformation.template_deployer: Error applying changes for CloudFormation stack "AwsCdkWithTypescriptFoundationsStack": An error occurred (DependencyViolation) when calling the DeleteRouteTable operation: The routeTable 'rtb-ea506a4e' has dependencies and cannot be deleted. Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1828, in _run
localstack_1  |     self.do_apply_changes_in_loop(changes, stack, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1879, in do_apply_changes_in_loop
localstack_1  |     self.apply_change(change, stack, new_resources, stack_name=stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1934, in apply_change
localstack_1  |     result = delete_resource(resource_id, old_stack.resources, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 984, in delete_resource
localstack_1  |     ec2_client.delete_route_table(RouteTableId=rt['RouteTableId'])
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 386, in _api_call
localstack_1  |     return self._make_api_call(operation_name, kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 705, in _make_api_call
localstack_1  |     raise error_class(parsed_response, operation_name)
localstack_1  | botocore.exceptions.ClientError: An error occurred (DependencyViolation) when calling the DeleteRouteTable operation: The routeTable 'rtb-ea506a4e' has dependencies and cannot be deleted.
localstack_1  | 
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.utils.cloudformation.template_deployer: Extract resource attribute: Custom::AWSCDK-EKS-Cluster Ref
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::Join': ['', ['aws eks update-kubeconfig --name ', {'Ref': 'HelloEKS39C624A1'}, ' --region ', {'Ref': 'AWS::Region'}, ' --role-arn ', {'Fn::GetAtt': ['HelloEKSMastersRole53742E60', 'Arn']}]]}} - Unable to fetch details for resource "HelloEKS39C624A1" (attribute "Ref")

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
okeeffedcommented, Aug 16, 2021

Pulled the latest image and this looks to no longer be an issue.

Closing this ticket.

1reaction
dominikschubertcommented, Mar 30, 2022

Closing this as there haven’t been any further responses.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon EKS troubleshooting - AWS Documentation
NodeCreationFailure: Your launched instances are unable to register with your Amazon EKS cluster. Common causes of this failure are insufficient node IAM role...
Read more >
Troubleshoot AWS EKS application deploy failure due to ...
The EKS worker node is deployed using AWS CloudFormation template. To re-generate the issue, we will use a public CloudFormation template (URL: ...
Read more >
Troubleshooting Deployments on Amazon EKS - Kubeflow
There are several problems that could lead to cluster creation failure. If you see some errors when creating your cluster using eksctl ...
Read more >
Troubleshooting | EKS Anywhere - AWS
Cluster creation fails because a cluster of the same name already exists. Try running the eksctl anywhere create cluster again, adding the --force-cleanup ......
Read more >
Why can't I connect to my Amazon EKS cluster? - YouTube
Skip directly to the demo: 0:28For more details see the Knowledge Center article with this video: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found