Add Custom Metadata to Pods

Use the metadata tunable to create custom labels for Hydrolix pods

Overview

The metadata tunable adds a dictionary for custom labeling for Hydrolix workloads. Labels and annotations propagate to all Kubernetes workloads the operator manages. Metadata labels work for services that control pods, and the pods themselves, but don't change configmap, secrets, or other services.

This functionality was added in version 5.3.

Validation of custom metadata

Hydrolix performs validation to protect internal labels and annotation names the operator uses.

  • Key names don't conflict with internal labels and annotation names used by Hydrolix.
  • Key names and values are validated by Kubernetes. If incorrect data is entered, the Kubernetes API responds with the correct regex for validation. See Working with Objects for Kubernetes regex patterns.

The Hydrolix operator ignores labels or annotations that fail these checks.

Add labels and annotations

Edit the hydrolixcluster.yaml file to add and edit metadata labels and annotations.

Annotate clusters

Add annotations to clusters to identify them.

In this example, add an email address to identify the cluster owner.

 metadata:
    annotations:
      hdx-cluster/owner: [email protected]

Use metadata with HTN

Use the metadata tunable with Hydrolix Tunable Names for finer control of pod behavior, if needed.

In this example, the metadata tunable is used for the query-head service only.

spec:
  metadata:
    labels:
      hello: world
  htn:metadata:query-head:::
    labels:    
      hello: query

⚠️

After changing the metadata value in the hydrolixcluster.yaml file, all services restart.

Use cases

Add labels for different purposes for tracking costs, monitoring, and operational insight.

  • Add labels to departments, teams, or assets to track cost
  • Add security context annotation for compliance scanning and identifying pods that handle sensitive data
  • Use custom labels to group pods in dashboards or alert rules in Prometheus
  • Prioritize critical pods with clear labels for easier identification

What’s Next