SlideShare une entreprise Scribd logo
1  sur  29
Monitoring Kubernetes
with prometheus-operator
Lili Cosic
Who am I?
● Lili Cosic
● @lilic on GitHub
● @lilicosic on Twitter
● Principal Software Engineer
● Engineer in the OpenShift in-cluster monitoring team.
● Maintainer and contributor to prometheus operator, kube prometheus, kube-
state-metrics and member of SIG Instrumentation.
Prometheus briefly
Credit: Prometheus official docs
prometheus-operator org
● https://github.com/prometheus-operator
● Consists of two projects right now:
○ Prometheus operator - the operator
○ kube-prometheus - collection of manifests for monitoring
kubernetes
● Independent organization with maintainers from
multiple companies
● 5.5k GitHub stars
● Adopters from various companies (add yourself if
you are using it!)
Prometheus Operator
Prometheus operator
● https://github.com/prometheus-operator/prometheus-operator
● One of the first Kubernetes operators created by CoreOS
● Simplifies managing, operating and configuring monitoring components within
your Kubernetes clusters
● Provides multi tenancy features
● Self service monitoring
Prometheus operator
● Custom Resources
○ Prometheus
○ Alertmanager
○ ServiceMonitor & PodMonitor
○ PrometheusRule
○ ThanosRuler
○ Probe
○ AlertmanagerConfig
Prometheus Custom Resource
● Configure the Prometheus
deployment in your Kubernetes
clusters
● Fields to know:
○ selectors
○ alerting
○ resources
○ replicas
Alertmanager Custom Resource
● Configure the Alertmanager
StatefulSet deployment in your
Kubernetes clusters
ServiceMonitor & PodMonitor Custom Resources
● Configure targets to be monitored in your cluster
● Difference between ServiceMonitor and
PodMonitor
○ ServiceMonitor -> selects pod(s) via Services
○ PodMonitor -> directly selects pod(s)
● Some interesting fields to look out for:
○ namespaceSelector
○ sampleLimit
○ targetLimit
ServiceMonitor & PodMonitor Custom Resources
● How does it work?
○ ServiceMonitor or PodMonitor get created by user
○ Operator picks the resource
○ Operator creates a Secret resource with the content of target discovery in prometheus
specific configuration
○ Config-reloader sidecar watches the secrets and reloads Prometheus if there are any
changes
PrometheusRule Custom Resource
● Create Alerting and Recording rules
● Alerting rules - define alert conditions
based on Prometheus expression
language expressions and to send
notifications about firing alerts to an
external service
● Recording rules - precompute
frequently needed or computationally
expensive expressions and save their
result as a new set of time series.
PrometheusRule Custom Resource
● How does it work?
○ Create PrometheusRule in namespace that prom-operator
watches
○ Operator picks that custom resource
○ Operator bin packs into ConfigMaps
○ Mounts ConfigMaps into Prometheus pod
○ config-reloader sidecar reloads prometheus
Probe Custom Resource
● Configure how groups of ingresses
or static targets should be
monitored.
● Operator automatically generates
Prometheus scrape configuration
● Deploy something like
blackbox_exporter
AlertmanagerConfig Custom Resource
● Configure subsections of Alertmanager
configuration
● Useful for routing alerts to custom receivers
● Setting inhibit rules
● Great in a multi tenant environment where you
don’t want to give admin access to
Alertmanager Custom Resource to everyone
ThanosRuler Custom Resource
● Configure, connect and deploy
Thanos Ruler
● Thanos Rule is a component in
Thanos that evaluates Prometheus
recording and alerting rules against
chosen query API.
● Useful for multi tenant
environments where multiple
Prometheus instances are
deployed
Cool overlooked features of prometheus-operator
● Automated Sharding - Specify in the Prometheus spec by setting the number
of shards to distribute targets onto.
● enforcedNamespaceLabel - great for multi tenancy
● Thanos sidecar - configure object storage
kube-prometheus
kube-prometheus project
● https://github.com/prometheus-operator/kube-prometheus
● Easily monitor your Kubernetes cluster infra workloads out of the box
● Building blocks of Kubernetes cluster monitoring
● You can customize the experience with jsonnet - we do this in OpenShift
clusters
○ Jsonnet - a data templating language that extends JSON
● We do not maintain the helm chart but it is widely used
What components?
● Prometheus Operator Deployment
● Highly available Prometheus - 2 replicas
● Highly available Alertmanager - 3 replicas
● kube-state-metrics - metrics about Kubernetes resources
● Prometheus node_exporter - metrics about nodes
● Prometheus Adapter for Kubernetes Metrics APIs
● Grafana + dashboards
● Monitoring Kubernetes cluster components
● Alerting and Recording rules about Kubernetes and monitoring components
What you get if you apply the manifests repo
Pods deployed within the cluster Targets being monitored
How to monitor your own applications
Example app manifests
Troubleshooting - targets page
Go to prometheus UI and access the /targets page to see all the targets that
Prometheus could discover or those it could not
Troubleshooting
● Set debug log level on prometheus-operator to see which ServiceMonitors
or PodMonitors it picked up.
● kubectl -n monitoring get secret prometheus-k8s -ojson |
jq -r '.data["prometheus.yaml.gz"]' | base64 -d | gunzip
| grep "my-service-monitor-name"
● po-lint is helper binary that decodes and validates your Custom Resources
Conclusion
Help and docs
● https://prometheus-operator.dev/ <- new website (thanks metalmatze!)
● We also have troubleshooting docs
● Slack channel -> #prometheus-operator channel on Kubernetes slack
● Open issue on GitHub
● Useful docs links:
○ Custom resources and fields docs
○ List of metrics from kube-state-metrics
○ Runbooks for alerts (please contribute more!)
○ Alerting
○ Monitor external etcd
○ Customize kube prometheus experience
Thank you!
Lili Cosic
@LiliCosic - Twitter
@lilic - GitHub

Contenu connexe

Tendances

Rancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep DiveRancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep DiveLINE Corporation
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewBob Killen
 
Kubernetes
KubernetesKubernetes
Kuberneteserialc_w
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Edureka!
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes ArchitectureKnoldus Inc.
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesGabriel Carro
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshoploodse
 
Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)DongHyeon Kim
 
Azure kubernetes service
Azure kubernetes serviceAzure kubernetes service
Azure kubernetes serviceVishwas N
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to KubernetesImesh Gunaratne
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideBytemark
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaYoungHeon (Roy) Kim
 
From my sql to postgresql using kafka+debezium
From my sql to postgresql using kafka+debeziumFrom my sql to postgresql using kafka+debezium
From my sql to postgresql using kafka+debeziumClement Demonchy
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionEric Gustafson
 
An overview of the Kubernetes architecture
An overview of the Kubernetes architectureAn overview of the Kubernetes architecture
An overview of the Kubernetes architectureIgor Sfiligoi
 

Tendances (20)

Rancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep DiveRancher 2.0 Technical Deep Dive
Rancher 2.0 Technical Deep Dive
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes Architecture
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshop
 
Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)Kubernetes internals (Kubernetes 해부하기)
Kubernetes internals (Kubernetes 해부하기)
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Azure kubernetes service
Azure kubernetes serviceAzure kubernetes service
Azure kubernetes service
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & Grafana
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
From my sql to postgresql using kafka+debezium
From my sql to postgresql using kafka+debeziumFrom my sql to postgresql using kafka+debezium
From my sql to postgresql using kafka+debezium
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
An overview of the Kubernetes architecture
An overview of the Kubernetes architectureAn overview of the Kubernetes architecture
An overview of the Kubernetes architecture
 

Similaire à Monitoring kubernetes with prometheus-operator

Monitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInDataMonitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInDataGetInData
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Brian Brazil
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scaleJuraj Hantak
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scaleAdam Hamsik
 
DevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheusDevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheusDevOps Braga
 
Implementing Observability for Kubernetes.pdf
Implementing Observability for Kubernetes.pdfImplementing Observability for Kubernetes.pdf
Implementing Observability for Kubernetes.pdfJose Manuel Ortega Candel
 
Prometheus (Microsoft, 2016)
Prometheus (Microsoft, 2016)Prometheus (Microsoft, 2016)
Prometheus (Microsoft, 2016)Brian Brazil
 
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017Bob Cotton
 
OSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike Klusik
OSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike KlusikOSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike Klusik
OSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike KlusikNETWAYS
 
Prometheus and Docker (Docker Galway, November 2015)
Prometheus and Docker (Docker Galway, November 2015)Prometheus and Docker (Docker Galway, November 2015)
Prometheus and Docker (Docker Galway, November 2015)Brian Brazil
 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With PrometheusKnoldus Inc.
 
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)Brian Brazil
 
Kubernetes Observability with Prometheus by Example
Kubernetes Observability with Prometheus by ExampleKubernetes Observability with Prometheus by Example
Kubernetes Observability with Prometheus by ExampleThomas Riley
 
How to Improve the Observability of Apache Cassandra and Kafka applications...
How to Improve the Observability of Apache Cassandra and Kafka applications...How to Improve the Observability of Apache Cassandra and Kafka applications...
How to Improve the Observability of Apache Cassandra and Kafka applications...Paul Brebner
 
Implementing Flux for Scale with Soft Multi-tenancy
Implementing Flux for Scale with Soft Multi-tenancyImplementing Flux for Scale with Soft Multi-tenancy
Implementing Flux for Scale with Soft Multi-tenancyWeaveworks
 

Similaire à Monitoring kubernetes with prometheus-operator (20)

Monitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInDataMonitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scale
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scale
 
Prometheus and Grafana
Prometheus and GrafanaPrometheus and Grafana
Prometheus and Grafana
 
DevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheusDevOps Braga #15: Agentless monitoring with icinga and prometheus
DevOps Braga #15: Agentless monitoring with icinga and prometheus
 
Prometheus workshop
Prometheus workshopPrometheus workshop
Prometheus workshop
 
Implementing Observability for Kubernetes.pdf
Implementing Observability for Kubernetes.pdfImplementing Observability for Kubernetes.pdf
Implementing Observability for Kubernetes.pdf
 
System monitoring
System monitoringSystem monitoring
System monitoring
 
Prometheus (Microsoft, 2016)
Prometheus (Microsoft, 2016)Prometheus (Microsoft, 2016)
Prometheus (Microsoft, 2016)
 
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
 
OSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike Klusik
OSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike KlusikOSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike Klusik
OSMC 2019 | Monitoring Cockpit for Kubernetes Clusters by Ulrike Klusik
 
Prometheus and Docker (Docker Galway, November 2015)
Prometheus and Docker (Docker Galway, November 2015)Prometheus and Docker (Docker Galway, November 2015)
Prometheus and Docker (Docker Galway, November 2015)
 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With Prometheus
 
Monitoring Cockpit for OpenShift Clusters
Monitoring Cockpit for OpenShift ClustersMonitoring Cockpit for OpenShift Clusters
Monitoring Cockpit for OpenShift Clusters
 
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
 
Kubernetes Observability with Prometheus by Example
Kubernetes Observability with Prometheus by ExampleKubernetes Observability with Prometheus by Example
Kubernetes Observability with Prometheus by Example
 
Docker Monitoring Webinar
Docker Monitoring  WebinarDocker Monitoring  Webinar
Docker Monitoring Webinar
 
How to Improve the Observability of Apache Cassandra and Kafka applications...
How to Improve the Observability of Apache Cassandra and Kafka applications...How to Improve the Observability of Apache Cassandra and Kafka applications...
How to Improve the Observability of Apache Cassandra and Kafka applications...
 
Implementing Flux for Scale with Soft Multi-tenancy
Implementing Flux for Scale with Soft Multi-tenancyImplementing Flux for Scale with Soft Multi-tenancy
Implementing Flux for Scale with Soft Multi-tenancy
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Dernier (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Monitoring kubernetes with prometheus-operator

  • 2. Who am I? ● Lili Cosic ● @lilic on GitHub ● @lilicosic on Twitter ● Principal Software Engineer ● Engineer in the OpenShift in-cluster monitoring team. ● Maintainer and contributor to prometheus operator, kube prometheus, kube- state-metrics and member of SIG Instrumentation.
  • 5. prometheus-operator org ● https://github.com/prometheus-operator ● Consists of two projects right now: ○ Prometheus operator - the operator ○ kube-prometheus - collection of manifests for monitoring kubernetes ● Independent organization with maintainers from multiple companies ● 5.5k GitHub stars ● Adopters from various companies (add yourself if you are using it!)
  • 7. Prometheus operator ● https://github.com/prometheus-operator/prometheus-operator ● One of the first Kubernetes operators created by CoreOS ● Simplifies managing, operating and configuring monitoring components within your Kubernetes clusters ● Provides multi tenancy features ● Self service monitoring
  • 8. Prometheus operator ● Custom Resources ○ Prometheus ○ Alertmanager ○ ServiceMonitor & PodMonitor ○ PrometheusRule ○ ThanosRuler ○ Probe ○ AlertmanagerConfig
  • 9. Prometheus Custom Resource ● Configure the Prometheus deployment in your Kubernetes clusters ● Fields to know: ○ selectors ○ alerting ○ resources ○ replicas
  • 10. Alertmanager Custom Resource ● Configure the Alertmanager StatefulSet deployment in your Kubernetes clusters
  • 11. ServiceMonitor & PodMonitor Custom Resources ● Configure targets to be monitored in your cluster ● Difference between ServiceMonitor and PodMonitor ○ ServiceMonitor -> selects pod(s) via Services ○ PodMonitor -> directly selects pod(s) ● Some interesting fields to look out for: ○ namespaceSelector ○ sampleLimit ○ targetLimit
  • 12. ServiceMonitor & PodMonitor Custom Resources ● How does it work? ○ ServiceMonitor or PodMonitor get created by user ○ Operator picks the resource ○ Operator creates a Secret resource with the content of target discovery in prometheus specific configuration ○ Config-reloader sidecar watches the secrets and reloads Prometheus if there are any changes
  • 13. PrometheusRule Custom Resource ● Create Alerting and Recording rules ● Alerting rules - define alert conditions based on Prometheus expression language expressions and to send notifications about firing alerts to an external service ● Recording rules - precompute frequently needed or computationally expensive expressions and save their result as a new set of time series.
  • 14. PrometheusRule Custom Resource ● How does it work? ○ Create PrometheusRule in namespace that prom-operator watches ○ Operator picks that custom resource ○ Operator bin packs into ConfigMaps ○ Mounts ConfigMaps into Prometheus pod ○ config-reloader sidecar reloads prometheus
  • 15. Probe Custom Resource ● Configure how groups of ingresses or static targets should be monitored. ● Operator automatically generates Prometheus scrape configuration ● Deploy something like blackbox_exporter
  • 16. AlertmanagerConfig Custom Resource ● Configure subsections of Alertmanager configuration ● Useful for routing alerts to custom receivers ● Setting inhibit rules ● Great in a multi tenant environment where you don’t want to give admin access to Alertmanager Custom Resource to everyone
  • 17. ThanosRuler Custom Resource ● Configure, connect and deploy Thanos Ruler ● Thanos Rule is a component in Thanos that evaluates Prometheus recording and alerting rules against chosen query API. ● Useful for multi tenant environments where multiple Prometheus instances are deployed
  • 18. Cool overlooked features of prometheus-operator ● Automated Sharding - Specify in the Prometheus spec by setting the number of shards to distribute targets onto. ● enforcedNamespaceLabel - great for multi tenancy ● Thanos sidecar - configure object storage
  • 20. kube-prometheus project ● https://github.com/prometheus-operator/kube-prometheus ● Easily monitor your Kubernetes cluster infra workloads out of the box ● Building blocks of Kubernetes cluster monitoring ● You can customize the experience with jsonnet - we do this in OpenShift clusters ○ Jsonnet - a data templating language that extends JSON ● We do not maintain the helm chart but it is widely used
  • 21. What components? ● Prometheus Operator Deployment ● Highly available Prometheus - 2 replicas ● Highly available Alertmanager - 3 replicas ● kube-state-metrics - metrics about Kubernetes resources ● Prometheus node_exporter - metrics about nodes ● Prometheus Adapter for Kubernetes Metrics APIs ● Grafana + dashboards ● Monitoring Kubernetes cluster components ● Alerting and Recording rules about Kubernetes and monitoring components
  • 22. What you get if you apply the manifests repo Pods deployed within the cluster Targets being monitored
  • 23. How to monitor your own applications
  • 25. Troubleshooting - targets page Go to prometheus UI and access the /targets page to see all the targets that Prometheus could discover or those it could not
  • 26. Troubleshooting ● Set debug log level on prometheus-operator to see which ServiceMonitors or PodMonitors it picked up. ● kubectl -n monitoring get secret prometheus-k8s -ojson | jq -r '.data["prometheus.yaml.gz"]' | base64 -d | gunzip | grep "my-service-monitor-name" ● po-lint is helper binary that decodes and validates your Custom Resources
  • 28. Help and docs ● https://prometheus-operator.dev/ <- new website (thanks metalmatze!) ● We also have troubleshooting docs ● Slack channel -> #prometheus-operator channel on Kubernetes slack ● Open issue on GitHub ● Useful docs links: ○ Custom resources and fields docs ○ List of metrics from kube-state-metrics ○ Runbooks for alerts (please contribute more!) ○ Alerting ○ Monitor external etcd ○ Customize kube prometheus experience
  • 29. Thank you! Lili Cosic @LiliCosic - Twitter @lilic - GitHub

Notes de l'éditeur

  1. Important thing to see here is, Alertmanager despite its name does not evaluate alerts, but prometheus does that. Alertmanager just distributes alerts to specific receiver e.g. email, pageduty, slack. Prometheus retrieves metrics and discovers targets and stores them in tsdb - custom time series database