Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Simplifying your Kubernetes infrastructure with...

Simplifying your Kubernetes infrastructure with CDK for Kubernetes (cdk8s)

Abhishek Gupta

August 31, 2023
Tweet

More Decks by Abhishek Gupta

Other Decks in Technology

Transcript

  1. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. D E V D AY A U G U S T 2 5 , 2 0 2 3
  2. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Simplifying your Kubernetes infrastructure with AWS CDK for Kubernetes (cdk8s) Abhishek Gupta Principal Developer Advocate Amazon Web Services 2
  3. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. abhirockzz.github.io/about/ @abhi_tweeter linkedin/in/abhirockzz
  4. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. What I actually do?
  5. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. …. using Agenda – Avoiding YAML 😉
  6. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. I hope you find this (book?) useful 🙂 8 Chapters GitHub repository
  7. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 9 AWS CloudFormation AWS Cloud Development Kit (AWS CDK) Infrastructure AS Code (IaC) Infrastructure IS Code
  8. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Cloud Development Kit (CDK) for Kubernetes (cdk8s) An open-source multi-language framework for modeling Kubernetes resources as reusable components Go from code to config Define Kubernetes applications and architectures using familiar programming languages Cut, copy & paste Turn best practices into code libraries and share easily Run everywhere cdk8s runs locally and generates YAML you can deploy to any cluster, anywhere Java
  9. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Demo – hello “cdk8s”
  10. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Manifests Assembly synth kubectl/GitOps CLI Kubernetes resources publish Publish packages Code repository Charts & constructs Source code code init Project cdk8s workflow
  11. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. 13 cdk8s components 1 1 2 2 3 3 cdk8s code Conceptual diagram
  12. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Improve productivity with cdk8s+ and Custom Constructs
  13. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. cdk8s+ (plus) 15 🤯 Nodejs example
  14. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. cdk8s+ (plus) 16 🧐 Go example
  15. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Custom constructs Reusable Composable Enforce best practices 17 constructs.dev
  16. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Demo – cdk8s-plus and custom constructs
  17. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Integrating with Kubernetes Custom Resource Definitions (CRDs)
  18. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Kubernetes Custom Resource Definitions (CRDs)
  19. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. AWS Controllers for Kubernetes (ACK) O P E N - S O U R C E P R O J E C T F O R M A N A G I N G A M A Z O N R E S O U R C E S F R O M K U B E R N E T E S A P I kubectl apply ACK supported AWS Services Custom resource Amazon RDS database Amazon EKS
  20. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. How do I use CRDs with cdk8s? 1. cdk8s import 🚀 2. Packages ready to use 🤯 3. Write code 🧑💻 4. cdk8s synth 💥
  21. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Demo – cdk8s + ACK on EKS
  22. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Manage Redis on AWS from Kubernetes
  23. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. cdk8s and AWS CDK 🤝
  24. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Paradigm Shift AWS CloudFormation CDK App Source Code Stack A Template A Template B AWS CloudFormation Stack B Parameterized Template Stack 1 Stack 2 CloudFormation Parameters and intrinsic functions CDK Typed OO language: loops, conditions, inheritence, etc
  25. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. https://imgflip.com/i/7wijoy
  26. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Deploying apps to EKS with AWS CDK – the ”hard” way 😓 1 2 3
  27. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. addManifest(….) CDK reference doc, godoc
  28. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. addCdk8sChart(…) to the rescue! CDK reference doc, godoc
  29. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Walkthrough – AWS CDK + cdk8s on EKS
  30. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Removing Less YAML Infrastructure-as-Code Infrastructure-IS-code Write code (not YAML) Optimize (cdk8s+), Reusability (constructs), Extend (CRD) Combine with AWS CDK, and more. cdk8s recap
  31. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Resources… 33 https://cdk8s.io/docs/latest/reference/ https://github.com/cdk8s-team/cdk8s/tree/master/examples/go/
  32. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Thank you! © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. @abhi_tweeter linkedin/in/abhirockzz
  33. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Please complete the session survey © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.