Skip to content

Instantly share code, notes, and snippets.

@crdant
Created December 29, 2023 16:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crdant/84a1d5a3b722537e76ab5f65b9069547 to your computer and use it in GitHub Desktop.
Save crdant/84a1d5a3b722537e76ab5f65b9069547 to your computer and use it in GitHub Desktop.
Updating the KOTS prometheus address with a Kubernetes job. You could do something similar in an init container.
apiVersion: batch/v1
kind: Job
metadata:
name: set-prometheus-address
spec:
template:
spec:
containers:
- image: nicolaka/netshoot
name: set-prometheus-address
command:
- bash
- "-c"
- |
curl http://kotsadm:3000/api/v1/prometheus -X POST -d '{ "value": "http://prometheus-kube-prometheus-prometheus.monitoring.svc:9090" }' -H "Authorization: ${AUTH_STRING}"
env:
- name: AUTH_STRING
valueFrom:
secretKeyRef:
name: kotsadm-authstring
key: kotsadm-authstring
restartPolicy: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment