prom-label-proxy
by Prometheus
A proxy that enforces a given label in a given PromQL query.
About this chart
prom-label-proxy
A proxy that enforces a given label in a given PromQL query.
Homepage: https://github.com/prometheus-community/prom-label-proxy
Usage
The chart is distributed as an OCI Artifact as well as via a traditional Helm Repository.
- OCI Artifact:
oci://ghcr.io/prometheus-community/charts/prom-label-proxy - Helm Repository:
https://prometheus-community.github.io/helm-chartswith chartprom-label-proxy
The installation instructions use the OCI registry. Refer to the [helm repo](helm repo) command documentation for information on installing charts via the traditional repository.
Install Chart
helm install [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prom-label-proxy
See configuration below.
See helm install for command documentation.
Uninstall Chart
helm uninstall [RELEASE_NAME]
This removes all the Kubernetes components associated with the chart and deletes the release.
See helm uninstall for command documentation.
Upgrading Chart
helm upgrade [RELEASE_NAME] [CHART] --install
See helm upgrade for command documentation.
Configuration
See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run these configuration commands:
helm show values oci://ghcr.io/prometheus-community/charts/prom-label-proxy
kube-rbac-proxy
You can enable prom-label-proxy endpoint protection using kube-rbac-proxy. By setting kubeRBACProxy.enabled: true, this chart will deploy one RBAC proxy container for config.listenAddress.
With the below example values.yaml :
config:
upstream: http://prometheus:9090
extraArgs:
- --enable-label-apis=true
- --header-name=X-Namespace
kubeRBACProxy:
enabled: true
config:
authorization:
rewrites:
byHttpHeader:
name: X-Namespace
resourceAttributes:
apiVersion: v1
resource: namespaces
subresource: metrics
namespace: "{{ .Value }}"
To authorize access, authenticate your requests (via a ServiceAccount for example) with a Role attached such as:
apiVersion: v1
kind: ServiceAccount
metadata:
name: tenant1-metrics-reader
namespace: tenant1
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: tenant1-metrics
namespace: tenant1
rules:
- apiGroups: [ '' ]
resources:
- namespaces/metrics
verbs: [ "create", "get" ]
---
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: tenant1-metrics-reader
namespace: tenant1
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: tenant1-metrics
subjects:
- kind: ServiceAccount
name: tenant1-metrics-reader
namespace: tenant1
See kube-rbac-proxy examples for more details.
Deploy prom-label-proxy with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prom-label-proxy on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprom-label-proxy is pinned at v0.25.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply