Prometheus-proxy for Lens
The snippet can be accessed without any authentication.
Authored by
Michael Wagner
This deploys a nginx which is forwarding metrics. In order to use it, open the cluster preferences in Lens, on metrics select "Helm" and let the metrics service point to x-ion-addons/prometheus-proxy:9090
.
prometheus-proxy.yaml 2.45 KiB
apiVersion: v1
kind: Service
metadata:
name: prometheus-proxy
namespace: x-ion-addons
spec:
selector:
app: prom-reverse-proxy
ports:
- name: prometheus
port: 9090
protocol: TCP
targetPort: 9090
sessionAffinity: None
type: ClusterIP
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: prometheus-proxy
namespace: x-ion-addons
spec:
replicas: 1
selector:
matchLabels:
app: prom-reverse-proxy
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: prom-reverse-proxy
spec:
containers:
- image: registry.gitlab.x-ion.de/paas-public/mirror/nginx:1.19.3
imagePullPolicy: IfNotPresent
name: nginx
ports:
- name: prometheus
containerPort: 9090
readinessProbe:
httpGet:
path: /-/ready
port: prometheus
timeoutSeconds: 10
livenessProbe:
httpGet:
path: /-/healthy
port: prometheus
timeoutSeconds: 10
startupProbe:
httpGet:
path: /-/healthy
port: prometheus
failureThreshold: 30
periodSeconds: 10
resources:
requests:
cpu: 50m
memory: 50Mi
limits:
cpu: 100m
memory: 150Mi
volumeMounts:
- name: config
mountPath: /etc/nginx
subPath: nginx.config
readOnly: true
initContainers:
- command:
- /bin/sh
- -c
- |
cat <<EOM > /tmp/nginx/nginx.conf
events {
worker_connections 1024; ## Default: 1024
}
http {
access_log /dev/stderr;
server {
listen 0.0.0.0:9090;
location / {
proxy_pass http://192.168.0.20:9090/;
}
}
}
EOM
image: registry.gitlab.x-ion.de/paas-public/mirror/busybox:1.32.0
name: config-builder
volumeMounts:
- name: config
mountPath: /tmp/nginx
subPath: nginx.config
readOnly: false
restartPolicy: Always
volumes:
- name: config
emptyDir: {}
Please register or sign in to comment