Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slashpai/prometheus-operator-examples
prometheus-operator example configs
https://github.com/slashpai/prometheus-operator-examples
examples kubernetes-operator prometheus-metrics prometheus-operator
Last synced: 9 days ago
JSON representation
prometheus-operator example configs
- Host: GitHub
- URL: https://github.com/slashpai/prometheus-operator-examples
- Owner: slashpai
- License: apache-2.0
- Created: 2022-04-04T11:13:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-02T14:20:51.000Z (10 months ago)
- Last Synced: 2024-04-18T18:28:30.258Z (7 months ago)
- Topics: examples, kubernetes-operator, prometheus-metrics, prometheus-operator
- Language: Shell
- Homepage:
- Size: 6.6 MB
- Stars: 3
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prometheus-operator-examples
**Disclaimer:** *The configs in this repo should be treated as examples only. This is not tested in production cluster. These examples can serve as a starting point for creating production ready configs.*
For each example config, check README page in respective folder.
Examples are created in `default` namespace
## Pre-requisites
Create kind cluster or minikube cluster (examples in this repo are tested with kind cluster)
## Create a playground kubernetes cluster
### kind cluster
This will create a multi-node kind cluster with one control plane node
and two worker nodes```bash
kind create cluster --name multi-node --config kind-config.yaml
```or
### minikube (not fully tested for all examples)
```bash
minikube start --nodes 3 -p multi-node --kubernetes-version=v1.27.3 --memory=6g --bootstrapper=kubeadm --extra-config=kubelet.authentication-token-webhook=true --extra-config=kubelet.authorization-mode=Webhook --extra-config=scheduler.bind-address=0.0.0.0 --extra-config=controller-manager.bind-address=0.0.0.0
```### Configure prometheus-operator
```bash
git clone https://github.com/prometheus-operator/prometheus-operator.git
cd prometheus-operator
# install crds
kubectl create -f example/prometheus-operator-crd-full
# deploy prometheus-operator
kubectl create -f example/rbac/prometheus-operator
```You should see prometheus-operator pod running
```bash
kubectl get pods
NAME READY STATUS RESTARTS AGE
prometheus-operator-bcbbc87bd-mmbrl 1/1 Running 0 3m47s
```### Create Prometheus stack
From this repo path:
```bash
kubectl create -f prometheus_only_stack
```You should see prometheus pods running after a while
```bash
prometheus-prometheus-0 2/2 Running 0 3m20s
prometheus-prometheus-1 2/2 Running 0 3m20s
```## Helpful Commands
- Access Prometheus UI
```bash
kubectl -n default port-forward svc/prometheus-operated 9090&
```## Notes
For most of the examples, app deployed is [prometheus-example-app](https://github.com/rhobs/prometheus-example-app). You can deploy a different app adjust configs accordingly (mainly the port number).
Port-forward the app deployed to see more metrices generated by the [prometheus-example-app](https://github.com/rhobs/prometheus-example-app). Otherwise you will see only `version` metric and [automatically generated timeseries](https://prometheus.io/docs/concepts/jobs_instances/#automatically-generated-labels-and-time-series) only in prometheus when you query.
If app is deployed as a pod:
```bash
kubectl port-forward pod/ 8080
```If service exists/deployed as a Deployment and exposed it through service
```bash
kubectl port-forward svc/ 8080
```