https://github.com/philips/etcd-prometheus-operator-demo
https://github.com/philips/etcd-prometheus-operator-demo
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/philips/etcd-prometheus-operator-demo
- Owner: philips
- License: apache-2.0
- Created: 2016-11-09T15:14:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-30T03:06:14.000Z (over 9 years ago)
- Last Synced: 2025-03-27T17:27:31.931Z (over 1 year ago)
- Size: 10.7 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# etcd-prometheus-operator-demo
Simple demonstration of using etcd and Prometheus operators together.
[Video demo from KubeCon](https://www.youtube.com/watch?v=Uf7PiHXqmnw&index=80&list=PLj6h78yzYM2PqgIGU1Qmi8nY7dqn9PCr4)
Pre-requisite:
- Working [minikube and kubectl](https://github.com/kubernetes/minikube#installation)
## Deploy Operators
Launch the [etcd Operator](https://coreos.com/blog/introducing-the-etcd-operator.html) and [Prometheus Operator](https://coreos.com/blog/the-prometheus-operator.html) in the cluster.
```
kubectl create -f https://coreos.com/operators/prometheus/latest/prometheus-operator.yaml
kubectl create -f https://coreos.com/operators/etcd/latest/deployment.yaml
```
## Run the demo-cluster and monitor
Create a three member etcd cluster called "demo-cluster"
```
kubectl create -f https://raw.githubusercontent.com/philips/etcd-prometheus-operator-demo/master/demo-cluster.yaml
```
Confirm it is working by finding three pods listed
```
kubectl get pods -l etcd_cluster=demo-cluster
```
Create a Prometheus service to monitor this cluster
```
kubectl create -f https://raw.githubusercontent.com/philips/etcd-prometheus-operator-demo/master/demo-cluster-monitoring.yaml
```
## Try out Prometheus
If you are using minikube simply do
```
minikube service demo-cluster-prometheus
```
Otherwise visit the nodePort on a node IP
```
kubectl describe service demo-cluster-prometheus
```
Try out a query in prometheus like graphing the total bytes sent between peers
```
rate(etcd_network_peer_sent_bytes_total[30s])
```
And now try and delete a peer and see what happens to the graphs
```
kubectl delete pod demo-cluster-0000
```
## Cleanup
```
kubectl delete -f https://github.com/philips/etcd-prometheus-operator-demo/blob/master/demo-cluster.yaml
kubectl delete -f https://raw.githubusercontent.com/philips/etcd-prometheus-operator-demo/master/demo-cluster-monitoring.yaml
```
## Putting some keys in
```
kubectl expose pod demo-cluster-0002 --selector='etcd_cluster=demo-cluster' --name=demo-cluster --type=NodePort -l etcd_cluster=demo-cluster --target-port 2379
```
```
EP=$(minikube service --url demo-cluster); while true; do etcdctl --endpoints ${EP} put hello etcd; done
```