https://slides.com/profiprog/cdk8s
12. Nov 2020 by Milan Skuhra
https://slides.com/profiprog/cdk8s
https://slides.com/profiprog/cdk8s
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
https://slides.com/profiprog/cdk8s
https://slides.com/profiprog/cdk8s
https://slides.com/profiprog/cdk8s
┌────────────────────────┐ ┌────────────┬────┬────┬───┐
│ │ │ │ │ │ │
│ 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
https://slides.com/profiprog/cdk8s
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
https://slides.com/profiprog/cdk8s
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
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
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
https://slides.com/profiprog/cdk8s
https://slides.com/profiprog/cdk8s