SlideShare a Scribd company logo
Providing a Rich Interface to
Prometheus
David Flanagan
rawkode
David Flanagan
Scottish
Founded Rawkode Academy
Previously Pulumi, Equinix Metal, and InfluxDB
https://rawkode.live
https://rawkode.chat
I’m here to remove YAML from
your lives
What’s the standard operating
procedure look like?
Deploy Your Application
1 apiVersion: apps/v1
2 kind: Deployment
3 metadata:
4 name: example-app
5 spec:
6 replicas: 3
7 selector:
8 matchLabels:
9 app: example-app
10 template:
11 metadata:
12 labels:
13 app: example-app
14 spec:
15 containers:
16 - name: example-app
17 image: fabxc/instrumented_app
18 ports:
19 - name: web
20 containerPort: 8080
Expose it over a Service
1 kind: Service
2 apiVersion: v1
3 metadata:
4 name: example-app
5 labels:
6 app: example-app
7 spec:
8 selector:
9 app: example-app
10 ports:
11 - name: web
12 port: 8080
Create a Service or Pod Monitor
1 apiVersion: monitoring.coreos.com/v1
2 kind: ServiceMonitor
3 metadata:
4 name: example-app
5 labels:
6 team: frontend
7 spec:
8 selector:
9 matchLabels:
10 app: example-app
11 endpoints:
12 - port: web
Connect ServiceMonitor to Prometheus
1 apiVersion: monitoring.coreos.com/v1
2 kind: Prometheus
3 metadata:
4 name: prometheus
5 spec:
6 serviceAccountName: prometheus
7 serviceMonitorSelector:
8 matchLabels:
9 team: frontend
10 resources:
11 requests:
12 memory: 400Mi
13 enableAdminAPI: false
14 alerting:
15 alertmanagers:
16 - namespace: default
17 name: alertmanager-example
18 port: web
19 ruleSelector:
20 matchLabels:
21 role: alert-rules
22 prometheus: example
23 ruleNamespaceSelector:
Deploy AlertManager
1 apiVersion: monitoring.coreos.com/v1
2 kind: Alertmanager
3 metadata:
4 name: example
5 spec:
6 replicas: 3
7 alertmanagerConfigSelector:
8 matchLabels:
9 alertmanagerConfig: example
10 ---
11 apiVersion: monitoring.coreos.com/v1alpha1
12 kind: AlertmanagerConfig
13 metadata:
14 name: config-example
15 labels:
16 alertmanagerConfig: example
17 spec:
18 route:
19 groupBy: ['job']
20 groupWait: 30s
21 groupInterval: 5m
22 repeatInterval: 12h
23 receiver: 'webhook'
24 receivers:
Add a PrometheusRule
1 apiVersion: monitoring.coreos.com/v1
2 kind: PrometheusRule
3 metadata:
4 creationTimestamp: null
5 labels:
6 prometheus: example
7 role: alert-rules
8 name: prometheus-example-rules
9 spec:
10 groups:
11 - name: ./example.rules
12 rules:
13 - alert: ExampleAlert
14 expr: vector(1)
How do we make this better?
Spoiler Alert
Helm
Kustomize
ytt
These are great tools, but they solve symptoms: they’re palliative
The answer isn’t YAML or templating
Why not use a programming
language?
Pulumi
Pulumi’s open source infrastructure as code SDK enables you to create, deploy, and manage infrastructure on
any cloud, using your favorite languages.
Infrastructure as Code
Pulumi
Same stack for infra and applications
Use familiar programming languages
Server Side Apply
CRD support
Pulumi
1 crd2pulumi --nodejsPath=pulumi-sdk-nodejs --force crds.yaml
2 crd2pulumi --goPath=pulumi-sdk-go --force https://github.com/raw/thingy/crds.yaml
3 crd2pulumi --dotnetPath=pulumi-sdk-dotnet --force https://doc.crds.dev/package/name
cdk8s
cdk8s is an open-source software development framework for defining Kubernetes applications and reusable
abstractions using familiar programming languages
Kubernetes as Code
cdk8s
Use familiar programming languages
Server Side Apply (kubectl)
CRD support
cdk8s
1 language: typescript
2 app: node main.js
3 imports:
4 - k8s
5 - https://github.com/raw/thingy/crds.yaml
6 - https://doc.crds.dev/package/name
Which?
Pulumi requires additional work to consume CRDs as code
cdk8s makes this much easier
However, Pulumi may be the same language you’re building your platform with
and Pulumi can apply to the cluster
It’s personal choice
Demo
Fingers crossed!
Summary
Using programming languages doesn’t mean less LOC
but our opportunity to abstract and compose is much greater
Use existing tooling
Testable
Distributable / sharable
Thank You
Questions?

More Related Content

Similar to OSMC 2022 | Providing a Rich Interface to the Prometheus Operator by David Flanagan

Architecting the Future: Abstractions and Metadata - CodeStock
Architecting the Future: Abstractions and Metadata - CodeStockArchitecting the Future: Abstractions and Metadata - CodeStock
Architecting the Future: Abstractions and Metadata - CodeStock
Daniel Barker
 
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP IntegrationBKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
Linaro
 
Fluentd meetup logging infrastructure in paa s
Fluentd meetup   logging infrastructure in paa sFluentd meetup   logging infrastructure in paa s
Fluentd meetup logging infrastructure in paa s
Rakuten Group, Inc.
 
Becoming a Plumber: Building Deployment Pipelines - RevConf
Becoming a Plumber: Building Deployment Pipelines - RevConfBecoming a Plumber: Building Deployment Pipelines - RevConf
Becoming a Plumber: Building Deployment Pipelines - RevConf
Daniel Barker
 
Software Composition Analysis Deep Dive
Software Composition Analysis Deep DiveSoftware Composition Analysis Deep Dive
Software Composition Analysis Deep Dive
Ulisses Albuquerque
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
María Angélica Bracho
 
Architecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCArchitecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKC
Daniel Barker
 
Android app development
Android app developmentAndroid app development
Android app development
Tanmoy Roy
 
Architecting the Future: Abstractions and Metadata - STL SilverLinings
Architecting the Future: Abstractions and Metadata - STL SilverLiningsArchitecting the Future: Abstractions and Metadata - STL SilverLinings
Architecting the Future: Abstractions and Metadata - STL SilverLinings
Daniel Barker
 
Hello cloud 6
Hello  cloud 6Hello  cloud 6
Hello cloud 6
Gireesh Kumar
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
João Esperancinha
 
Perfomatix - NodeJS Coding Standards
Perfomatix - NodeJS Coding StandardsPerfomatix - NodeJS Coding Standards
Perfomatix - NodeJS Coding Standards
Perfomatix Solutions
 
EclipseOMRBuildingBlocks4Polyglot_TURBO18
EclipseOMRBuildingBlocks4Polyglot_TURBO18EclipseOMRBuildingBlocks4Polyglot_TURBO18
EclipseOMRBuildingBlocks4Polyglot_TURBO18
Xiaoli Liang
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™
IBM
 
Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.
Joseph Labrecque
 
Mobile application security
Mobile application securityMobile application security
Mobile application security
Shubhneet Goel
 
Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application Security
Ishan Girdhar
 
Appium solution
Appium solutionAppium solution
Appium solution
Nael Abd Eljawad
 

Similar to OSMC 2022 | Providing a Rich Interface to the Prometheus Operator by David Flanagan (20)

Architecting the Future: Abstractions and Metadata - CodeStock
Architecting the Future: Abstractions and Metadata - CodeStockArchitecting the Future: Abstractions and Metadata - CodeStock
Architecting the Future: Abstractions and Metadata - CodeStock
 
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP IntegrationBKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
BKK16-409 VOSY Switch Port to ARMv8 Platforms and ODP Integration
 
Fluentd meetup logging infrastructure in paa s
Fluentd meetup   logging infrastructure in paa sFluentd meetup   logging infrastructure in paa s
Fluentd meetup logging infrastructure in paa s
 
Becoming a Plumber: Building Deployment Pipelines - RevConf
Becoming a Plumber: Building Deployment Pipelines - RevConfBecoming a Plumber: Building Deployment Pipelines - RevConf
Becoming a Plumber: Building Deployment Pipelines - RevConf
 
Software Composition Analysis Deep Dive
Software Composition Analysis Deep DiveSoftware Composition Analysis Deep Dive
Software Composition Analysis Deep Dive
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
 
Architecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKCArchitecting the Future: Abstractions and Metadata - BSidesKC
Architecting the Future: Abstractions and Metadata - BSidesKC
 
Android app development
Android app developmentAndroid app development
Android app development
 
Architecting the Future: Abstractions and Metadata - STL SilverLinings
Architecting the Future: Abstractions and Metadata - STL SilverLiningsArchitecting the Future: Abstractions and Metadata - STL SilverLinings
Architecting the Future: Abstractions and Metadata - STL SilverLinings
 
Hello cloud 6
Hello  cloud 6Hello  cloud 6
Hello cloud 6
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Perfomatix - NodeJS Coding Standards
Perfomatix - NodeJS Coding StandardsPerfomatix - NodeJS Coding Standards
Perfomatix - NodeJS Coding Standards
 
EclipseOMRBuildingBlocks4Polyglot_TURBO18
EclipseOMRBuildingBlocks4Polyglot_TURBO18EclipseOMRBuildingBlocks4Polyglot_TURBO18
EclipseOMRBuildingBlocks4Polyglot_TURBO18
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in KubernetesScaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
 
Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™
 
Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.
 
Mobile application security
Mobile application securityMobile application security
Mobile application security
 
Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application Security
 
Appium solution
Appium solutionAppium solution
Appium solution
 

Recently uploaded

Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
Drona Infotech
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
Rakesh Kumar R
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Top 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptxTop 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptx
devvsandy
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 

Recently uploaded (20)

Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Top 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptxTop 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptx
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 

OSMC 2022 | Providing a Rich Interface to the Prometheus Operator by David Flanagan

  • 1. Providing a Rich Interface to Prometheus David Flanagan rawkode
  • 2. David Flanagan Scottish Founded Rawkode Academy Previously Pulumi, Equinix Metal, and InfluxDB https://rawkode.live https://rawkode.chat
  • 3. I’m here to remove YAML from your lives
  • 4. What’s the standard operating procedure look like?
  • 5. Deploy Your Application 1 apiVersion: apps/v1 2 kind: Deployment 3 metadata: 4 name: example-app 5 spec: 6 replicas: 3 7 selector: 8 matchLabels: 9 app: example-app 10 template: 11 metadata: 12 labels: 13 app: example-app 14 spec: 15 containers: 16 - name: example-app 17 image: fabxc/instrumented_app 18 ports: 19 - name: web 20 containerPort: 8080
  • 6. Expose it over a Service 1 kind: Service 2 apiVersion: v1 3 metadata: 4 name: example-app 5 labels: 6 app: example-app 7 spec: 8 selector: 9 app: example-app 10 ports: 11 - name: web 12 port: 8080
  • 7. Create a Service or Pod Monitor 1 apiVersion: monitoring.coreos.com/v1 2 kind: ServiceMonitor 3 metadata: 4 name: example-app 5 labels: 6 team: frontend 7 spec: 8 selector: 9 matchLabels: 10 app: example-app 11 endpoints: 12 - port: web
  • 8. Connect ServiceMonitor to Prometheus 1 apiVersion: monitoring.coreos.com/v1 2 kind: Prometheus 3 metadata: 4 name: prometheus 5 spec: 6 serviceAccountName: prometheus 7 serviceMonitorSelector: 8 matchLabels: 9 team: frontend 10 resources: 11 requests: 12 memory: 400Mi 13 enableAdminAPI: false 14 alerting: 15 alertmanagers: 16 - namespace: default 17 name: alertmanager-example 18 port: web 19 ruleSelector: 20 matchLabels: 21 role: alert-rules 22 prometheus: example 23 ruleNamespaceSelector:
  • 9. Deploy AlertManager 1 apiVersion: monitoring.coreos.com/v1 2 kind: Alertmanager 3 metadata: 4 name: example 5 spec: 6 replicas: 3 7 alertmanagerConfigSelector: 8 matchLabels: 9 alertmanagerConfig: example 10 --- 11 apiVersion: monitoring.coreos.com/v1alpha1 12 kind: AlertmanagerConfig 13 metadata: 14 name: config-example 15 labels: 16 alertmanagerConfig: example 17 spec: 18 route: 19 groupBy: ['job'] 20 groupWait: 30s 21 groupInterval: 5m 22 repeatInterval: 12h 23 receiver: 'webhook' 24 receivers:
  • 10. Add a PrometheusRule 1 apiVersion: monitoring.coreos.com/v1 2 kind: PrometheusRule 3 metadata: 4 creationTimestamp: null 5 labels: 6 prometheus: example 7 role: alert-rules 8 name: prometheus-example-rules 9 spec: 10 groups: 11 - name: ./example.rules 12 rules: 13 - alert: ExampleAlert 14 expr: vector(1)
  • 11.
  • 12.
  • 13.
  • 14. How do we make this better?
  • 15. Spoiler Alert Helm Kustomize ytt These are great tools, but they solve symptoms: they’re palliative The answer isn’t YAML or templating
  • 16.
  • 17. Why not use a programming language?
  • 18.
  • 19. Pulumi Pulumi’s open source infrastructure as code SDK enables you to create, deploy, and manage infrastructure on any cloud, using your favorite languages. Infrastructure as Code
  • 20. Pulumi Same stack for infra and applications Use familiar programming languages Server Side Apply CRD support
  • 21. Pulumi 1 crd2pulumi --nodejsPath=pulumi-sdk-nodejs --force crds.yaml 2 crd2pulumi --goPath=pulumi-sdk-go --force https://github.com/raw/thingy/crds.yaml 3 crd2pulumi --dotnetPath=pulumi-sdk-dotnet --force https://doc.crds.dev/package/name
  • 22. cdk8s cdk8s is an open-source software development framework for defining Kubernetes applications and reusable abstractions using familiar programming languages Kubernetes as Code
  • 23. cdk8s Use familiar programming languages Server Side Apply (kubectl) CRD support
  • 24. cdk8s 1 language: typescript 2 app: node main.js 3 imports: 4 - k8s 5 - https://github.com/raw/thingy/crds.yaml 6 - https://doc.crds.dev/package/name
  • 25. Which? Pulumi requires additional work to consume CRDs as code cdk8s makes this much easier However, Pulumi may be the same language you’re building your platform with and Pulumi can apply to the cluster It’s personal choice
  • 27. Summary Using programming languages doesn’t mean less LOC but our opportunity to abstract and compose is much greater Use existing tooling Testable Distributable / sharable