Skip to content

Commit

Permalink
Add annotation for Prometheus in Kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
zubron committed May 21, 2018
1 parent f37538c commit c50fcfa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ In this branch, we revert the code from the previous branch that triggered the a
Once the change has been reverted and deployed, the error rate will decrease, and eventually the
alert will stop firing. Once this has happened, the Alertmanager will send another message to the
configured Slack webhook to state that the error has been resolved.

### S5

This branch contains an optional change to show how you can modify your Helm chart to be
scraped using Kubernetes service discovery.

If you are running Prometheus in Kubernetes alongside your application, you can modify your
[service definition](./todo-app/chart/templates/service.yaml) to add an annotation to use service
discovery.
With this annotation, Prometheus will add your service as a target, and will scrape it.
2 changes: 2 additions & 0 deletions todo-app/chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
annotations:
prometheus.io/scrape: "true"
labels:
app: {{ template "name" . }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion todo-app/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
replicaCount: 1
image:
repository: todo-demo
tag: s4
tag: s5
pullPolicy: IfNotPresent
service:
name: todo-app
Expand Down

0 comments on commit c50fcfa

Please sign in to comment.