Skip to content
Snippets Groups Projects
Commit 22f74523 authored by Adrian-George Dumitrache's avatar Adrian-George Dumitrache
Browse files

Add k8s configs for Kube Prometheus stack

parent b8a560bf
No related branches found
No related tags found
1 merge request!6Add k8s configs for Kube Prometheus stack
......@@ -14,8 +14,15 @@ This repository houses all Kubernetes configuration files for the SongRate proje
To run the project locally, you can use Minikube. First, make sure you have it installed and running.
```bash
minikube start
minikube start --extra-config=kubelet.authentication-token-webhook=true \
--extra-config=kubelet.authorization-mode=Webhook
minikube addons enable ingress
minikube addons disable metrics-server
helm repo add kong https://charts.konghq.com
helm repo add portainer https://portainer.github.io/k8s/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
kubectl apply -f prerequisites/
kubectl apply -f kong/
......@@ -23,23 +30,28 @@ kubectl apply -f adminer/
kubectl apply -f database/
# Install Kong ingress controller
helm repo add kong https://charts.konghq.com
helm repo update
helm install kong kong/ingress -n kong --create-namespace
# Install Portainer
helm repo add portainer https://portainer.github.io/k8s/
helm repo update
helm upgrade --install portainer portainer/portainer --set image.tag=lts
helm install portainer portainer/portainer --set image.tag=lts
kubectl apply -f portainer/
helm install prometheus prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespace --version 45.7.1 \
-f grafana/grafana-values.yaml -f prometheus/prometheus-values.yaml
kubectl apply -f prometheus/
kubectl apply -f grafana/
minikube tunnel # this will require root privileges and will block the terminal
```
Then acquire the Kong Proxy IP address:
```bash
export PROXY_IP=$(kubectl get svc --namespace kong kong-gateway-proxy -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export PROXY_IP=$(kubectl get svc --namespace kong kong-gateway-proxy \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo $PROXY_IP
```
......
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana-ingress
namespace: monitoring
annotations:
konghq.com/strip-path: "true" # Strip the /grafana prefix
konghq.com/plugins: "request-transformer"
konghq.com/request-transformer: |
config:
add:
headers:
- X-Forwarded-Prefix:/grafana
spec:
ingressClassName: kong
rules:
- http:
paths:
- path: /grafana
pathType: Prefix
backend:
service:
name: prometheus-grafana
port:
number: 80
\ No newline at end of file
grafana:
env:
GF_SERVER_ROOT_URL: "%(protocol)s://%(domain)s/grafana"
GF_SERVER_SERVE_FROM_SUB_PATH: "true"
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: prometheus-ingress
namespace: monitoring
annotations:
konghq.com/strip-path: "false" # Do not strip the /prometheus prefix
spec:
ingressClassName: kong
rules:
- http:
paths:
- path: /prometheus
pathType: Prefix
backend:
service:
name: prometheus-operated
port:
number: 9090
prometheus:
prometheusSpec:
externalUrl: /prometheus
routePrefix: /prometheus
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment