Istio-enabled kube-prometheus-stack
An example repository showing how the kube-prometheus-stack Helm chart could be patched to support Istio without modifying Kubernetes resources after installing the chart.
Based on prometheus-community/helm-charts#145.
I used the post-renderer technique with kustomize (see 1, 2) to patch the
existing and inject extra resources into the helm-generated k8s manifests.
- Kustomize 3.5+
installed in
$PATH. - Helm 3.1+ installed.
- A k8s cluster (or use
helm templateinstead ofhelm upgrade -iin the command below)
- Create the
metricsnamespace and enable Istio injection for the namespace. - Make the
kustomize-pipeexecutable:chmod +x kustomize-pipe. - Run:
helm upgrade -i monitoring prometheus-community/kube-prometheus-stack \ --namespace metrics \ --values values.yaml \ --post-renderer ./kustomize-pipe \ --debug --dry-run
The command will install the kube-prometheus-stack chart
using values.yaml with Istio-specific patches applied by
Kustomize (see kustomization.yaml):
- Enforces Istio mTLS for the namespace while allowing Prometheus k8s service
discovery (
networking.yaml). - Patches specific
ServiceMonitorsto use the injected Istio mTLS certificates. - Sets
appProtocol: httpto knownServiceports to fix the Istio protocol selection.