In this video, Mr.Eli Polonsky, Software Development Engineer at AWS talks about how the Kubernetes application management can be simplified to a great extent with the help of cdk8s (CDK for Kubernetes).
AWS CDK allows users to write code that describes their AWS resources. The building blocks of CDK applications are called constructs that represent composition. Constructs can be single or multiple AWS resources. They can be complete cloud formation stacks or applications that are composed of multiple stacks.
At 3:38, the speaker briefs that Kubernetes manifests are written in YAML.YAML code becomes harder to maintain when you have to define a lot of AWS resources and as the size of your application grows. At 5:19, Mr. Eli defines cdk8s as an open-source multi-language software development framework for designing and modeling Kubernetes resources as reusable components.
At 6:18, Mr.Eli illustrates the concept of Cdk8s by explaining the development workflow. Cdk8s is used to create a Cdk8s project in any language. You can also use project generators to generate your Cdk8s project. The application is then defined using Cdk8s APIs and by creating constructs and charts. Once the user is satisfied with the resource definition, the application can be synthesized.
After the synth process is complete, Kubernetes manifests are generated. Users can now take the manifest and apply it in the way they desire. Users can use GitOps tools like Flux, Argo. Users can go ahead to publish their application to standard package managers for others to consume.
Construct levels and combining AWS CDK with AWS Cdk8s
At 7:50, the speaker talks about the construct levels. The Cdk8 consists of three different API levels each building on top of the other. Level 0 represents a generic Kubernetes API object. This level contains only the common functionality like the API version, metadata, and kind. You can use this to define an object. The next level is ‘Level 1’ which represents concrete API objects.
This is completely auto-generated from the Kubernetes API specification and provides strongly typed classes for each of the Kubernetes resources. ‘Level 2’ APIs represent the same concrete objects but are handcrafted to provide a simpler experience, implementing a lot of underlying mechanics on the user’s behalf. This is then followed by a live demo that depicts how Cdk8s can be used for managing and building the Kubernetes resources.
At 17:34, Mr.Eli briefs on the idea behind combining CDK and Cdk8s. Many users wanted to combine the AWS CDK with the AWS Cdk8s in the same application. Real-time applications combine elements from these two domains. He adds that the AWS team was already working on an internal application that could benefit from this integration. The application had a VPC and an EKS (Elastic Kubernetes Service) cluster.
The application also needed an SQS (Simple Queue Service) which would subscribe to an SNS topic. In addition, the Amazon Elastic search service was used to index data. All these services were easily provisioned and managed by means of AWS CDK. Within the EKS cluster, there was a simple deployment with one pod that contained the runtime code.
The same can also be created with Cdk8s. The issue was that the pod required access to both SQS and to the elastic search service and the deployment turned into a complicated process.
At 18:53, Mr. Eli mentions that due to the complexity of large scale-application, it is recommended to treat the entire architecture as a single deployable unit. AWS CDK is required to take care of the provisioning and deployment process.
Cdk8s charts can be extended to configure the environment variables. It is recommended to use both AWS CDK and AWS cdk8s together when you want to develop large-scale applications that require the normal AWS resources as well as the Kubernetes resources. In this video, Mr.Eli has briefed on how to use the construct programming and the cdk8s library in order to define your Kubernetes applications as reusable components within your organization.