Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prometheus example #513

Merged
merged 4 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: System tests
- name: Dry run examples
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
make install-tools
kind create cluster --image kindest/node:v1.19.1
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.crds.yaml
# Create CRD PodMonitor without running Prometheus operator
curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml | sed "s/replicas: 1$/replicas: 0/" | kubectl apply -f -
make install
sleep 3 # otherwise we sporadically observe 'no matches for kind "RabbitmqCluster" in version "rabbitmq.com/v1beta1'
kubectl apply --dry-run=server --recursive -f docs/examples/
system_tests:
Expand Down
11 changes: 11 additions & 0 deletions docs/examples/prometheus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Prometheus Example

See [Monitoring RabbitMQ in Kubernetes](https://www.rabbitmq.com/kubernetes/operator/operator-monitoring.html) for detailed instructions.

If you deployed the [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator), make Prometheus scrape RabbitMQ nodes by:
```shell
kubectl apply -f rabbitmq-podmonitor.yaml
```

Alternatively, if you deployed the Prometheus Operator via the [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) Helm chart,
set the values in [kube-prometheus-stack-values.yaml.example](kube-prometheus-stack-values.yaml.example) when installing / upgrading the Helm chart.
11 changes: 11 additions & 0 deletions docs/examples/prometheus/kube-prometheus-stack-values.yaml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
prometheus:
additionalPodMonitors:
- name: rabbitmq
podMetricsEndpoints:
- port: prometheus
selector:
matchLabels:
app.kubernetes.io/component: rabbitmq
namespaceSelector:
any: true
14 changes: 14 additions & 0 deletions docs/examples/prometheus/rabbitmq-podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: rabbitmq
spec:
podMetricsEndpoints:
- interval: 15s
port: prometheus
selector:
matchLabels:
app.kubernetes.io/component: rabbitmq
namespaceSelector:
any: true