https://slides.com/profiprog/cdk8s

14. stretnutie komunity ohľadne technológií Cloud Native – Kubernetes

CDK for Kubernetes

cdk8s.io

12. Nov 2020 by Milan Skuhra

https://slides.com/profiprog/cdk8s

Agenda

  • CDK Ekosystem
     
  • CDK for Kubernets
     
  • Demo
     
  • What does CDK8S supports
     
  • Summarization

https://slides.com/profiprog/cdk8s

CDK Ekosystem

CDK - Cloud Development Kit

AWS CDK https://aws.amazon.com/cdk/

Introducing CDK for Kubernetes (13. May 2020)

Introducing the Cloud Development Kit for Terraform (16. Jul 2020)

https://slides.com/profiprog/cdk8s

What is AWS CDK?

https://slides.com/profiprog/cdk8s

How CDK works?

https://slides.com/profiprog/cdk8s

JSii

https://slides.com/profiprog/cdk8s

JSii - Architecture Overview

┌────────────────────────┐             ┌────────────┬────┬────┬───┐
│                        │             │            │    │    │   │
│   User's Application   │             │@jsii/kernel│LibA│LibB│...│
│                        │             │            │    │    │   │
│     ┌──────────────────┤             ├────────────┴────┴────┴───┤
│     │                  │             │                          │
│     │Generated Bindings│             │      @jsii/runtime       │
│     │                  │             │                          │
│     ├──────────────────┤             ├────────┬─────────────────┤
│     │                  ├────────────▶│ STDIN  │                 │
│     │Host jsii Runtime │    JSON     ├────────┤                 │
│     │                  │◀────────────┤ STDOUT │   node          │
├─────┴──────────────────┤             ├────────┘                 │
│                        │             │     (Child Process)      │
│    JVM / .NET / ...    │             │                          │
│                        │             │                          │
├────────────────────────┴─────────────┴──────────────────────────┤
│                                                                 │
│                        Operating System                         │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

https://slides.com/profiprog/cdk8s

CDK for Kubernetes

  • Define Kubernetes applications and componets using familiar programming languages
     
  • Use the same tools to build your application and its configuration
     
  • Compose and share reusable components through code libraries
     
  • cdk8s apps synthesize into standard Kubernetes manifests which can be applied to any Kubernetes cluster.

https://slides.com/profiprog/cdk8s

Concept of a Construct

Basic building blocks of CDK apps

L1

L2

L3+

K8S Basic Resources

High Level Resorces

Purpose-build constructs

Automaticaly generated

Service constructs

Opinionated abstraction

https://slides.com/profiprog/cdk8s

Demo

https://slides.com/profiprog/cdk8s

What else can CDK8S do ?

Dependencies

const namespaceChart = new NamespaceChart(app, 'namespace');
const applicationChart = new ApplicationChart(app, 'application');
applicationChart.addDependency(namespaceChart);

Helm support

class MyChart extends cdk8s.Chart {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const redis = new Helm(this, 'redis', {
      chart: 'bitnami/redis',
      values: {
        sentinel: {
          enabled: true
        }
      }
    });
  }
}

https://slides.com/profiprog/cdk8s

What else can CDK8S do ?

Include existing YAML manifest

import { Include } from 'cdk8s';

class MyChart extends Chart {
  constructor(scope: Construct, id: string) {
    super(scope, id);
    const dashboard = new Include(this, 'dashboard', {
      url: 'https://raw.githubusercontent.com/
kubernetes/dashboard/v2.0.0/aio/deploy/
recommended.yaml',
      // or url: 'dashboard.yaml'
    });
    // ...
  }
}

https://slides.com/profiprog/cdk8s

What else can CDK8S do ?

cdk8s+

npm install cdk8s-plus cdk8s
pip install cdk8s-plus cdk8s
ConfigMap
Container
Deployment
Ingress
Job
Pod
Secret
ServiceAccount
Service
Volume

https://slides.com/profiprog/cdk8s

Summarization

  • advantages / disadvantages
     
  • CDK8S vs. Helm
     
  • When is CDK8S suitable?
     
  • complexity or simplicity
     
  • about possible uses

https://slides.com/profiprog/cdk8s

Read more

https://slides.com/profiprog/cdk8s

Thank you

cdk8s

By profiprog

cdk8s

Cloud Development Kit for Kubernetes

  • 237