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

Write your Kubernetes Infrastructure as Go code...

Write your Kubernetes Infrastructure as Go code with CDK for Kubernetes (cdk8s)

Abhishek Gupta

October 18, 2023
Tweet

More Decks by Abhishek Gupta

Other Decks in Technology

Transcript

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

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Open Source India 2023 Write your Kubernetes Infrastructure as Go code with CDK for Kubernetes (cdk8s) Abhishek Gupta Principal Developer Advocate Amazon Web Services 1 @abhi_tweeter linkedin/in/abhirockzz
  2. © 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
  3. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. I work on Kubernetes…. CNCF Landscape X
  4. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Really?
  5. © 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?
  6. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. …. using Agenda – Avoiding YAML 😉
  7. © 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
  8. © 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
  9. © 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
  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. 12 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) 14 🤯 Nodejs example
  14. © 2023, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved. Custom constructs Reusable Composable Enforce best practices 16 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 ”hello world” cdk8s-plus 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 URL shortener application
  22. © 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. Recap
  23. © 2023, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Resources… 24 https://cdk8s.io/docs/latest/reference/ https://github.com/cdk8s-team/cdk8s/tree/master/examples/go/
  24. © 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
  25. © 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.