Monitoring cloud native apps creates a whole new set of challenges that traditional monitoring systems struggle with. In this Workshop, Brice Fernandes from Weaveworks will take you through installing and using the open source Prometheus monitoring toolkit to monitor a Kubernetes cluster. You do not need any previous experience with Kubernetes or Prometheus. After this talk, you'll be able to set up a development kubernetes cluster and use Prometheus to monitor your microservices. We'll cover: An introduction to Kubernetes to manage containers; The monitoring maturity model; An overview of whitebox and blackbox monitoring; Monitoring with Prometheus; Using PromQL (the Prometheus Query Language) to monitor your app in a dynamic system.
1. Making sure your cluster isn't on fire
Hands-on monitoring with Prometheus
Brice Fernandes â brice@weave.works â February 2018
1
2. Q: Who uses docker?
Q: Who uses Kubernetes?
Q: Who uses Prometheus?
Hello Amsterdam đ
2
3. Deploy and test a service
Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
3
&
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Log in to cloud 9 instance
Instrument the application
Inspect business metrics
BREAK
Q & A
đ»
4. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
4
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
9. 9
Log in to cloud 9 instance đ»
1. Log in to your instance
2. Take a look at the demo application in demo-
app.
3. Find out whatâs running on the cluster with
†docker ps
11. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
11
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
12. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
12
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
45. 45
Deploy the service using kubectl đ»
1. Edit the service definition file manifests/app.yaml to
refer to your version
2. Deploy the service
†kubectl apply -f manifests/app.yaml
3. Deploy the ingress
†kubectl apply -f manifests/ingress.yaml
4. Navigate to .../mighty-fine to check the service runs
50. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
50
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
51. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
51
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
62. Use the dashboard definition in
demo-app/resources/docker-monitoring_rev1.json
Create a dashboard using Grafanaâs import functionality.
62
Inspect the system metrics đ»
64. âJSON all the way
âDashboards as data
âCan start with
dashboards
65. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
65
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
66. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
66
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
67. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
67
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
79. 79
1 Availability
2 Collection
3 Aggregation
4 Analysis
5 Learning
6 Automation
7 ProactivityThe
Monitoring
Ladder
You know whether your
systems are available.
You may have alerts
0 Ignorance
1 Availability
0 Ignorance
98. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
98
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
99. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
99
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
108. 1. Checkout v2-default-metrics
2. Rebuild the image with a new tag
†docker build -t mighty-fine:v2 .
3. Change the manifests/app.yaml to refer to the new
image, and use kubectl to apply the manifest again.
4. Look in prometheus for nodejs* metrics
10
8
Instrument the app to get middleware metrics đ»
112. 1. Checkout v3-custom-metrics
2. Rebuild the image with a new tag
†docker build -t mighty-fine:v3 .
3. Change the manifests/app.yaml to refer to the new
image, and use kubectl to apply the manifest again.
4. Look in prometheus for sales* metrics
11
2
Instrument the app to get middleware metrics đ»
122. 1. Checkout v4-subscription-service
2. Rebuild the image with a new tag
†docker build -t mighty-fine:v4 .
3. Change the manifests/app.yaml to refer to the new
image, and use kubectl to apply the manifest again.
4. Look in prometheus for un/subscribe_count metrics
12
2
Instrument the app to get business metrics đ»
136. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
13
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A
137. Setting up an environment
Starting out with Kubernetes
- Introduction to Kubernetes
- Deploying to Kubernetes using kubectl
Monitoring in practice
- Setting up Prometheus
- Setting up Grafana
- Inspecting system metrics
Understanding Monitoring
- Monitoring: Why and How?
- Monitoring maturity
- The prometheus model
Monitoring in depth
- Using different types of metrics
- Using PromQL
- Instrumenting your code
13
&
Log in to cloud 9 instance
đ»
Deploy and test a service
Inspect system metrics
Instrument the platform
Inspect middleware metrics
Instrument the application
Inspect business metrics
BREAK
Q & A