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.

[aws-eks] document how to define dependencies between k8s resources

See original GitHub issue

Kubernetes resources are not deployed in the order they were added via add_resource method. If one of them is a namespace, for instance, others fail with a namespace not found error.

Reproduction Steps

eks_cluster = aws_eks.Cluster(..)
eks_cluster.add_resource('namespace', namespace_resource)
eks_cluster.add_resource('resource_1', resource_1_deployed_in_the_namespace)
..
eks_cluster.add_resource('resource_n', resource_n_deployed_in_the_namespace)

Error Log

  2/53 | 10:48:01 | CREATE_IN_PROGRESS   | Custom::AWSCDK-EKS-KubernetesResource | DevEksCluster/DevEksCluster/manifest-NginxRole/Resource/Default (DevEksClustermanifestNginxRoleEE01848C) Resource creation Initiated
  3/53 | 10:48:01 | CREATE_FAILED        | Custom::AWSCDK-EKS-KubernetesResource | DevEksCluster/DevEksCluster/manifest-NginxRole/Resource/Default (DevEksClustermanifestNginxRoleEE01848C) Failed to create resource. b'Error from server (NotFound): error when creating "/tmp/manifest.yaml": namespaces "ingress-nginx" not found\n'
	new CustomResource (/tmp/jsii-kernel-jIZKhq/node_modules/@aws-cdk/aws-cloudformation/lib/custom-resource.js:32:25)
	\_ new KubernetesResource (/tmp/jsii-kernel-jIZKhq/node_modules/@aws-cdk/aws-eks/lib/k8s-resource.js:22:9)
	\_ Cluster.addResource (/tmp/jsii-kernel-jIZKhq/node_modules/@aws-cdk/aws-eks/lib/cluster.js:215:16)
	\_ _wrapSandboxCode (/home/lky/Repositories/HuuugeStarsCfConfig/contrib/cloudformation/cdk/eks/cluster/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6498:51)
	\_ Kernel._wrapSandboxCode (/home/lky/Repositories/HuuugeStarsCfConfig/contrib/cloudformation/cdk/eks/cluster/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7131:20)
	\_ ret._ensureSync (/home/lky/Repositories/HuuugeStarsCfConfig/contrib/cloudformation/cdk/eks/cluster/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6498:25)
	\_ Kernel._ensureSync (/home/lky/Repositories/HuuugeStarsCfConfig/contrib/cloudformation/cdk/eks/cluster/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7102:20)

Environment

  • CLI Version :1.4.0
  • Framework Version:1.4.0
  • OS :all
  • Language :all

Other


This is 🐛 Bug Report

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
arjanschaafcommented, Apr 26, 2020

@FarshadNiayesh I ran into a similar situation and provided an example on how to create a dependency between two helm charts. But it would also work to provide a dependency between the namespace & chart: https://github.com/aws/aws-cdk/issues/7592#issuecomment-619598485

0reactions
farshadniayeshpourcommented, Apr 23, 2020

Yes, dependencies can be used to specify order between resources. We should add some example in the EKS module’s README that demonstrates this.

@eladb can you provide an example of how to do this? I am trying to create a dependency between namespace and helm chart.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-eks module - AWS Documentation
This construct library allows you to define Amazon Elastic Container Service for Kubernetes (EKS) clusters. In addition, the library also supports defining ......
Read more >
Pod Security - EKS Best Practices Guides
According to the Kubernetes documentation, the PSS "define three different policies to broadly cover the security spectrum. These policies are cumulative ...
Read more >
Provision an EKS Cluster (AWS) | Terraform
Graph of Relationships - Terraform understands dependency relationships between resources. For example, if an AWS Kubernetes cluster needs a specific VPC ...
Read more >
AWS EKS Module - Terraform Registry
Inspired by and adapted from this doc and its source code. Read the AWS docs on EKS to get connected to the k8s...
Read more >
How do you visualise dependencies in your Kubernetes ...
When you have a large number of resources in your Kubernetes cluster, you might lose track of all relationships between them. Learn how...
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