NatronTech Logo
Best Practices

Annotations and Labels Best Practices

Annotations and Labels

Best practices for using Kubernetes annotations and labels.

What are Labels?

Labels are key-value pairs attached to Kubernetes objects. They are used to select and group objects. They are often used to group objects by environment (e.g. env=prod, env=staging, env=dev), by application (e.g. app=myapp), or by team (e.g. team=myteam).

They can also be used to group objects by other criteria, for example to select objects for specific tools and libraries (like Ingress Controllers, Prometheus, or ArgoCD).

What are Annotations?

Annotations are key-value pairs attached to Kubernetes objects. Unlike labels, which are used to select and group objects, annotations are used to attach arbitrary non-identifying metadata. This data is often used by tools and libraries (like Ingress Controllers, Prometheus, or ArgoCD) to trigger specific behaviors or configurations.

Official Kubernetes Annotations Documentation

Common Labels and Annotations for Natron

Natron uses labels and annotations to control the behavior of its components. The following labels and annotations are used by Natron:

  • gitops.natron.io/allow-prometheus: Allow Prometheus to scrape the metrics endpoint.
  • gitops.natron.io/allow-ingress-internal

Namespace Labels

KeyValuesDescription
pod-security.kubernetes.io/enforceprivileged baseline restrictedPod Security Standards. See also Pod Security Standards.
pod-security.kubernetes.io/enforce-versione.g. v1.33Version of Kubernetes PSS.
gitops.natron.io/trustedtrueTrusted label (e.g. for Kyverno Policies) which should only apply for all Natron Managed Namespaces.

Pod Labels

According to Well-Known Labels, Annotations and Taints.

KeyValuesDescription
gitops.natron.io/allow-ingress-externaltrueAllow ingress controller pod to reach pods in other namespaces
gitops.natron.io/allow-prometheustrueAllow prometheus pod to reach pods in other namespaces
gitops.natron.io/allow-teleporttrueAllow teleport-kube-agent pod to reach pods in other namespaces
gitops.natron.io/lb-poolinternal externalService label selector for CiliumLoadBalancerIPPool
gitops.natron.io/loki-ruletrueLoki Alerting-Rule label (See Loki Alerting)
grafana_dashboard{tenant-number} (e.g. 1)Grafana Dashboard label

Annotations

KeyValuesDescription
gitops.natron.io/application-Name of application
gitops.natron.io/customer-Name of customer
gitops.natron.io/stagepoc dev test prodName of stage

On this page