Is it possible to specify AWS resources in cdk8s?

289 Views Asked by At

It looks like cdk8s gets synthesized only to Kubernetes manifest files. CDK can manage AWS resources directly, such as EKS clusters, security groups and IAM roles and policies. Is it possible to have only a single file with code that manages both AWS resources and Kubernetes objects?

2

There are 2 best solutions below

0
On

Unfortunately, at the moment it is not possible to manage AWS resources directly from cdk8s. You would need to write CDK code for AWS resources and CDK8s code for kube resources.

Current way that I have tried creating a single place for both types of resources is to have a cfn directory with CDK app and a k8s directory with a k8s app as. And then glue them together via means of a pipeline. High level structure is like below

enter image description here

0
On

Yes, using Crossplane.

https://github.com/crossplane/crossplane

https://github.com/crossplane-contrib/provider-aws

Sample cdk8s.yaml

language: typescript
app: npx ts-node main.ts
imports:
  - k8s
  - github:crossplane/crossplane
  - github:crossplane-contrib/provider-aws