[Session Report] Effective Kubernetes management with cdk8s #BOA310

This session report talks about managing kubernetes deployment, various k8 objects using cdk8s, cdk8s-plus, AWS Controller for kubernetes and AWS CodeWhisperer to simplify operations around kubernetes as a developer.
2023.11.29

There has been a tremendous increase in the adoption of Kubernetes among organizations from 2021 to 2022. The numbers are skyrocketing.

With this increase, the complexity of operations as a developer has also increased.

The most frequent problem of a front-end team/backend developers; is how to manage deployment inside the k8 cluster, thing get even complex when they have to manage networking and role-based access control for the same.

This session report highlights from the session in re:Invent 2023 which talks about how as a developer they create/deploy k8 deployment using cdk8 and simplify operations, how to manage k8 objects in their favourite programming language without writing any YAML code.

session image

Rise in adoption of Kubernetes clusters

Kubernetes being open source with great community support has tools that are meant to be for k8 and the biggest advantage of running container with networking and storage at scale has led to a rise in the popularity of k8s for many organizations

adoption rate of kubernetes

Problem with YAML for writing Kubernetes Manifests

YAML is Great when you have a few things(Kubernetes objects to manage). Managing k8 objects gets difficult when it gets big. There are many other tools like helm, kustomize to manage Kubernetes manifestation which makes the learning curve and day-to-day operations for a developer

Some of the problems related to YAML.

  • YAML Does not follow the DRY principle
  • Updates are complex
  • Promotes copy and pasting when it gets big.

Event Helm charts are written in YAML. Every artifact that Kustomize uses is also written in YAML. Eventually, it will lead developers to deal with YAML.

Developer: Can i do magement of k8 deployment in my favourite language?

cdk definition

The modern answer is to use a modern IaC tool: cdk8s

cdk in nutshell

In a nutshell, what cdk8s does is that it allows developers to define k8 applications and architecture using familiar programming languages. Write code that represents charts and constructs source code which is synthesised into Kubernetes manifests(YAML) which can be applied with kubectl/ gitops approach.

cdk approach

Simplify further to absolutely writing no builder code

cdk8s have a library called cdk8s-plus: API abstraction which abstracts the basic YAML code common to any Kubernetes object

cdk8s-api abstraction

How to manage AWS resources in the configuration using cdk8s?

AWS controller for Kubernetes allows you to define and use AWS service resources directly from the Kubernetes cluster. Currently, it supports 30 services . ack

  • From pods, a use case example would be to connect to rds from pods.
  • ACK tool will manage AWS resources.
  • ACK controller speaks directly to AWS API
  • Your k8 cluster will single source of truth for the entire infrastructure.

Is there a way to combine cdk8s, cdk8s-plus and ACK controller

Yes, here it suggested ways to achieved this

combine all tolls

Make it even easy using CodeWhisperer(AI) !!!

codewhisperer how it works

We can combine the capabilities of auto-completion based on the context of the code of CodeWhisperer to further simplify the code writing and reduce our time, ultimately leading to faster production. You can either complete suggestions, word by word or edit the suggestion.

code whisperer suggestion

Let's Verify the results of cdk8s

To verify the operations of cdk8s the session incorporates a 2-tier application with the following requirements

requiremnts

Once the cdk8s code was synthesised, the Kubernetes manifest which was generated was a pure YAML code which required no YAML knowledge in any way. The generated manifest then can be applied either using kubectl or gitops approach

Results of cdk8s manifest

results-1

results-2

results-3

Takeaways

This session focussed on how developers can increase their productivity and reduce their learning curve (to zero) when it comes to handling Kubernetes deployment using cdk8s, ACK, and cdk8s-plus as it allows them to generate write Kubernetes manifests resource configuration in their favourite programming language. CDK8s does not only help developers but also helps the DevOps team administration for the cluster as the damage or misconfigurations by developers reduce a lot.

In summary.

  • cdk8: multi-language software development framework for modelling k8 resources
  • cdk8s-plus: library with high-level abstraction
  • AWS Controller for Kubernetes(ACK): tool to define and use AWS resources directly from Kubernetes