This is a simple golang application that pushes metrics to Prometheus which are availbale in Grafana.
- Install
microk8s
- Enable
registry
anddashboard
plugins inmicrok8s
- Run
microk8s inspect
- as you have enabled registry it will ask you to update config, complete the same - Create dockerimage using
docker build -f Dockerfile -t localhost:32000/gometrics:v1
- Run
docker push localhost:32000/gometrics:v1
- Now run
kubectl apply -f kompose/golang-deployment.yaml
- Now run
kubectl apply -f kompose/golang-service.yaml
- Install
helm
- Run
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- Run
helm repo update
- Run
helm install prometheus prometheus-community/kube-prometheus-stack
- Now you have the application, grafana (via dashboard plugin) and prometheus enabled
- Run
microk8s dashboard-proxy
to see the kubernetes dashboard - You should be able to access the services via their IP that you see in Kuberenetes dashboard
- Install
minikube
- Run `eval $(minikube docker-env)
- Create dockerimage using
docker build -f Dockerfile -t gometrics:v1
- Now run
kubectl apply -f kompose/golang-deployment.yaml
- Now run
kubectl apply -f kompose/golang-service.yaml
- Install
helm
- Run
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- Run
helm repo update
- Run
helm install prometheus prometheus-community/kube-prometheus-stack
- Now you have the application, grafana (via dashboard plugin) and prometheus enabled
- Run
minikube dashboard &
to view the Kubernetes dashboard - Run
minikube service --url gometrics
, this provides an URL where the gometrics application is running. Use/metrics
path to view the captured metrics - Similarly you can run
grafana
andprometheus
using the above command