Installation methods
Important
Set the environment values before proceeding with the installation of the EDB Postgres AI agent for external Kubernetes cluster.
This table outlines the configuration settings required to ensure your application deploys with the correct security permissions across various Kubernetes environments and Red Hat OpenShift:
| Environment | Configuration | OpenShift Flag |
|---|---|---|
| KIND, GKE, EKS, AKS | Uses image defaults (numeric or named) | openshift.enabled: false (default) |
| OpenShift (RHOS) | Compatible via runAsUser: null (SCC assigns ID) | openshift.enabled: false/true (optional) |
Key points:
- Universal Compatibility: The chart defaults to
runAsUser: null, allowing OpenShift SCCs to assign valid UIDs automatically, while standard Kubernetes falls back to the image's default user. - Security Context: runAsNonRoot strategy varies by component to ensure compatibility with standard Kubernetes validation logic vs OpenShift named-user support.
- OTEL collector: Uses the image default user (nonroot) without explicit numeric IDs to satisfy both strict K8s validation and OpenShift SCCs.
Downloading the Helm chart and customizing the values file
Obtain an EDB subscription token.
Download the EDB Postgres AI agent chart from the EDB repository:
helm repo add enterprisedb-pgai-platform "https://downloads.enterprisedb.com/$EDB_SUBSCRIPTION_TOKEN/pgai-platform/helm/charts/"
Create a
custom-values.yamlfile that includes your Hybrid Manager (HM) access credentials:# Required: Your HM access credentials agentConfig: accessKey: ${HM_ACCESS_KEY} projectID: ${HM_PROJECT_ID} beaconServer: host: ${HM_URL} plaintext: false metrics: push: endpoint: ${HM_URL} webhook: enabled: true podSelector: ${POD_SELECTOR} # Required: Docker registry credentials for EDB images image: repository: docker.enterprisedb.com/pgai-platform/upm-beacon/upm-beacon-agent tag: ${AGENT_VERSION} imageCredentials: registry: docker.enterprisedb.com username: pgai-platform password: ${EDB_SUBSCRIPTION_TOKEN} # OTEL collector image otelImage: repository: "docker.enterprisedb.com/pgai-platform/upm-beacon-external-metrics-receiver" tag: ${AGENT_VERSION} # Optional: Enable additional monitoring components additionalCharts: cert-manager: install: false opentelemetry-collector: install: true # Enable for metrics collection kube-state-metrics: install: true # Enable for Kubernetes state metrics prometheus-node-exporter: install: true # Enable for node metrics (requires privileged access) # Security context for the agent securityContext: runAsUser: 65532 runAsGroup: 65532 podSecurityContext: fsGroup: null # kube-state-metrics uses the image default user kube-state-metrics: podSecurityContext: null # Required if opentelemetry-collector.install is true: opentelemetry-collector: image: repository: "docker.enterprisedb.com/pgai-platform/upm-beacon-external-metrics-receiver" tag: ${AGENT_VERSION} podSecurityContext: seccompProfile: type: RuntimeDefault securityContext: runAsUser: 65532 runAsGroup: 65532 runAsNonRoot: true allowPrivilegeEscalation: false capabilities: drop: - ALL
For other configuration parameters and options, see the Configuration reference.
Apply the helm chart:
- For standard Kubernetes (GKE, EKS, AKS, KIND):
helm upgrade --install beacon-agent-k8s \ enterprisedb-pgai-platform/beacon-agent-k8s \ --create-namespace \ --namespace upm-beacon \ --values custom-values.yaml
- For OpenShift clusters, add the
--set openshift.enabled=trueflag:
helm upgrade --install beacon-agent-k8s \ enterprisedb-pgai-platform/beacon-agent-k8s \ --create-namespace \ --namespace upm-beacon \ --set openshift.enabled=true \ --values custom-values.yaml
Important
Grant SCC if using OTEL collector:
oc adm policy add-scc-to-user privileged \ system:serviceaccount:upm-beacon:beacon-agent-k8s-opentelemetry-collector kubectl -n upm-beacon rollout restart daemonset beacon-agent-k8s-opentelemetry-collector-agent
To allow your target namespace to pull the required images, copy the beacon-agent-pull-secret from the agent's namespace to the CloudNativePG™ cluster namespace:
kubectl get secrets -n "$AGENT_NS" -oyaml beacon-agent-pull-secret | grep -v '^\s*namespace:\s' | kubectl apply -n "$TARGET_NS" -f -
Deploying the external cluster with monitoring extensions
The EDB Postgres AI agent collects query and wait-state metrics from extensions that must be present in the monitored cluster. Deploy your external cluster with the following bootstrap.initdb.postInitApplicationSQL commands in your database (${PG_DATABASE}) and postgresql settings so the monitoring extensions are created and preloaded when the cluster is initialized.
Note
Because the manifest doesn't set bootstrap.initdb.owner, CNPG defaults the owner to the database name. As a result, CNPG creates an unprivileged Postgres role (user) with the exact same name as the target database (${PG_DATABASE}) and makes it the owner of that database. The grants in the init SQL reference this role by the ${PG_DATABASE} name.
Note
The init SQL runs only on first initialization (postInitApplicationSQL). Apply it when you create the cluster. For an existing cluster, create the schema, grants, and extensions manually in the database and add the libraries to shared_preload_libraries (requires a restart). For pg_stat_ch, also set pg_stat_ch.use_otel to on and pg_stat_ch.otel_endpoint to 127.0.0.1:4317.
The init SQL:
- Creates the
edb_internalsschema in${PG_DATABASE}and grantsUSAGEon it to the database owner role (${PG_DATABASE}, which CNPG creates with the same name as the database) andpg_monitor. - Creates the
edb_stat_monitor,query_advisor,edb_wait_states, andpg_stat_chextensions in that schema. - Sets the database
search_pathandtimezone.
The postgresql block enables pg_stat_statements, preloads aidb, edb_stat_monitor, query_advisor, edb_wait_states, and pg_stat_ch via shared_preload_libraries, and configures pg_stat_ch to export data using OpenTelemetry. The pg_stat_ch extension requires version 1.407.6 or later of the beacon agent.
Important
${PG_IMAGE} must be an EDB Postgres AI image that bundles the aidb, edb_stat_monitor, query_advisor, edb_wait_states, and pg_stat_ch extensions. The community manifest uses the upstream CloudNativePG operator API but still requires these EDB extensions.
For the enterprise operator, you can find a suitable image in the HM Asset Library. For the community operator, build a custom image that installs the EDB build of pg_stat_ch. For installation details, see Installing and configuring pg_stat_ch.
The image name can be postgresql, edb-postgres-advanced, or edb-postgres-extended, depending on the Postgres distribution you want to run.
CloudNativePG (community operator)
apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: ${PG_CLUSTER_NAME} namespace: ${TARGET_NS} labels: k8s.enterprisedb.io/beacon: enabled spec: backup: target: primary plugins: - name: barman-cloud.cloudnative-pg.io isWALArchiver: true parameters: barmanObjectName: ${PG_CLUSTER_NAME}-bck bootstrap: initdb: database: ${PG_DATABASE} postInitApplicationSQL: - CREATE SCHEMA IF NOT EXISTS edb_internals - GRANT USAGE ON SCHEMA edb_internals TO ${PG_DATABASE} - GRANT USAGE ON SCHEMA edb_internals TO pg_monitor - CREATE EXTENSION IF NOT EXISTS edb_stat_monitor WITH SCHEMA edb_internals - CREATE EXTENSION IF NOT EXISTS query_advisor WITH SCHEMA edb_internals - CREATE EXTENSION IF NOT EXISTS edb_wait_states WITH SCHEMA edb_internals - CREATE EXTENSION IF NOT EXISTS pg_stat_ch WITH SCHEMA edb_internals - ALTER DATABASE ${PG_DATABASE} SET search_path TO "\$user", public, edb_internals - ALTER DATABASE ${PG_DATABASE} SET timezone TO 'UTC' imageName: ${PG_IMAGE} postgresql: parameters: pg_stat_statements.max: "10000" pg_stat_statements.track: all pg_stat_ch.use_otel: "on" pg_stat_ch.otel_endpoint: "127.0.0.1:4317" shared_preload_libraries: - aidb - edb_stat_monitor - query_advisor - edb_wait_states - pg_stat_ch instances: 2 storage: size: 1Gi inheritedMetadata: labels: k8s.enterprisedb.io/beacon: enabled
EDB Postgres AI for CloudNativePG (enterprise operator)
The enterprise manifest uses the EDB operator API, adds an imagePullSecrets entry for the EDB registry, and additionally grants USAGE on the public schema to the database owner role (${PG_DATABASE}) and pg_monitor.
apiVersion: postgresql.k8s.enterprisedb.io/v1 kind: Cluster metadata: name: ${PG_CLUSTER_NAME} namespace: ${TARGET_NS} labels: k8s.enterprisedb.io/beacon: enabled spec: backup: target: primary plugins: - name: barman-cloud.cloudnative-pg.io isWALArchiver: true parameters: barmanObjectName: ${PG_CLUSTER_NAME}-bck bootstrap: initdb: database: ${PG_DATABASE} postInitApplicationSQL: - CREATE SCHEMA IF NOT EXISTS edb_internals - GRANT USAGE ON SCHEMA edb_internals TO ${PG_DATABASE} - GRANT USAGE ON SCHEMA edb_internals TO pg_monitor - GRANT USAGE ON SCHEMA public TO ${PG_DATABASE} - GRANT USAGE ON SCHEMA public TO pg_monitor - CREATE EXTENSION IF NOT EXISTS edb_stat_monitor WITH SCHEMA edb_internals - CREATE EXTENSION IF NOT EXISTS query_advisor WITH SCHEMA edb_internals - CREATE EXTENSION IF NOT EXISTS edb_wait_states WITH SCHEMA edb_internals - CREATE EXTENSION IF NOT EXISTS pg_stat_ch WITH SCHEMA edb_internals - ALTER DATABASE ${PG_DATABASE} SET search_path TO "\$user", public, edb_internals - ALTER DATABASE ${PG_DATABASE} SET timezone TO 'UTC' imagePullSecrets: - name: edb-pull-secret imageName: ${PG_IMAGE} postgresql: parameters: pg_stat_statements.max: "10000" pg_stat_statements.track: all pg_stat_ch.use_otel: "on" pg_stat_ch.otel_endpoint: "127.0.0.1:4317" shared_preload_libraries: - aidb - edb_stat_monitor - query_advisor - edb_wait_states - pg_stat_ch inheritedMetadata: labels: k8s.enterprisedb.io/beacon: enabled instances: 2 storage: size: 1Gi
Apply the manifest with kubectl apply -f <manifest>.yaml (use envsubst first if you parameterized it with environment values).
WAL-archiver plugin on OpenShift
Both example manifests declare a barman-cloud.cloudnative-pg.io WAL-archiver plugin. This plugin isn't bundled with the operator and is only needed if you want WAL archiving or backups for the monitored cluster — it isn't required for monitoring. If you don't need it, remove the plugins and backup blocks.
If you do use it on OpenShift, the upstream plugin manifest is rejected by the restricted-v2 SCC because it sets legacy seccomp annotations and runAsUser: 10001. Install it with both stripped. With the enterprise (EDB) operator you must also grant the plugin get/list/watch on clusters and patch/update on clusters/finalizers for the postgresql.k8s.enterprisedb.io API group; the upstream plugin only grants this on the community postgresql.cnpg.io group, so without it the cluster never reconciles (cannot set blockOwnerDeletion … can't set finalizers).
Patching clusters to enable the agent sidecar
This section shows how to patch a single cluster. You can adapt the instructions below to patch many clusters:
Define the target resource you wish to patch. Export the TARGET_NAME for your CloudNativePG™ cluster or PGD group (for EDB Postgres® AI for CloudNativePG™ Cluster) to which you wish to add the agent.
export TARGET_UID="$(kubectl get "${TARGET_TYPE}" "${TARGET_NAME}" -n "${TARGET_NS}" -o jsonpath='{.metadata.uid}')"
Create the configuration patch. This template adds the necessary labels and ensures the agent can pull the required images:
PATCH_CONTENT=$(cat <<EOF metadata: labels: k8s.enterprisedb.io/beacon: enabled spec: imagePullSecrets: - name: beacon-agent-pull-secret inheritedMetadata: labels: k8s.enterprisedb.io/beacon: enabled k8s.enterprisedb.io/beacon-project-id: "${HM_PROJECT_ID}" k8s.enterprisedb.io/beacon-resource-id: "${TARGET_NAME}-${TARGET_UID}" EOF )
Run the following command to merge the configuration changes into your resource:
kubectl patch pgdgroup "${TARGET_NAME}" -n "${TARGET_NS}" --type='merge' -p "$PATCH_CONTENT"Restart the cluster to bring the agent online.
For CNPG clusters:
kubectl cnp restart "$TARGET_NAME"For EDB Postgres® AI for CloudNativePG™ Cluster clusters:
Restart each node in the group:
kubectl cnp restart region-a-1 kubectl cnp restart region-a-2 kubectl cnp restart region-a-3
Verifying the installation
After the cluster restarts, confirm the EDB Postgres® AI agent is reporting to HM:
- Log in to the HM console and select Estate.
- Locate your cluster. It shows the External CNP Cluster label under the Management column.
- Allow up to six minutes for metrics to appear (a five-minute backend refresh plus up to a one-minute console refresh).
If the cluster or its metrics haven't appeared after that, double-check the secrets, labels, and Helm values from the previous steps. For more information, see Troubleshooting.
Configuring security contexts for external Kubernetes clusters
For standard Kubernetes (KIND, GKE, EKS, AKS)
Configure your custom-values.yaml with default secure settings which include user and group IDs:
securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL privileged: false readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 10000 runAsGroup: 10000 podSecurityContext: seccompProfile: type: RuntimeDefault
For OpenShift Kubernetes clusters
Enable the OpenShift mode to automatically configure security contexts for SCC compatibility.
Enable OpenShift support in your
custom-values.yamlfile:openshift: enabled: true
When the value is set to
openshift.enabled: true, the chart automatically:- Omits
runAsUserandrunAsGroupfrom the container security contexts, allowing SCC to assign them. - Stores other security settings like
capabilities.drop,readOnlyRootFilesystem, etc. - Uses numeric UID 65532 for the OTEL collector that is required for distroless image validation.
- Omits
Alternatively, specify your configuration via the command line using the
-f custom-values.yamlflag:securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL privileged: false readOnlyRootFilesystem: true runAsNonRoot: true
Leave the fields below empty as OpenShift will assign them automatically:
runAsUser: runAsGroup:
When deploying to OpenShift, ensure the
fsGroupfield remains undefined to allow the platform to manage volume permissions automatically:podSecurityContext: seccompProfile: type: RuntimeDefault
To ensure OpenShift compatibility, configure the OTEL collector subchart with a restricted security context:
opentelemetry-collector: podSecurityContext: seccompProfile: type: RuntimeDefault securityContext: runAsNonRoot: true allowPrivilegeEscalation: false capabilities: drop: - ALL
Configure the security context to prohibit root access, manage volume permissions via file system groups, and restrict system calls using the default seccomp profile.
securityContext: enabled: true runAsNonRoot: true runAsUser: runAsGroup: fsGroup: seccompProfile: type: RuntimeDefault
Note
Implementing a standardized security context for your deployments ensures seamless compatibility and enhanced security across diverse container platforms.
Distroless image support: The UID/GID
65532is the standard "nonroot" user for distroless images, which lacks a traditional/etc/passwdfile.Numeric validation: Setting a specific numeric ID is required for the
runAsNonRoot: truedirective to verify the user identity correctly.OpenShift compatibility: While OpenShift's Privileged SCC allows any UID, using 65532 ensures a consistent, secure identity across both OpenShift and standard Kubernetes environments.
Key configuration notes:
OpenShift ID management: The
runAsUser,runAsGroup, andfsGroupfields are left empty to allow OpenShift’s SCC to automatically assign the correct UID and GID ranges for the project.Security context activation: The setting
enabled: trueensures the subchart applies the specified security settings rather than falling back to its internal defaults.Non-root enforcement: The
runAsNonRoot: trueflag remains active to guarantee that the container never runs with root privileges, even when IDs are dynamically assigned by the platform.Seccomp hardening: Utilizing the
RuntimeDefaultprofile ensures the container uses the container runtime's default secure syscall filter.
Harden the container-level security context by enforcing a read-only filesystem, disabling privilege escalation, and dropping all default Linux capabilities:
containerSecurityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false capabilities: drop: - ALL
Alternatively, you can apply these settings via the command line:
helm upgrade --install beacon-agent-k8s \ . \ --namespace upm-beacon \ --create-namespace \ # ... your other flags ... --set securityContext.runAsUser=null \ --set securityContext.runAsGroup=null \ --set podSecurityContext.fsGroup=null \ --set opentelemetry-collector.securityContext.runAsUser=null \ --set opentelemetry-collector.securityContext.runAsGroup=null \ --set kube-state-metrics.podSecurityContext=null
Additional requirements for OpenShift
OpenShift assigns a specific UID range to each namespace. For example: 1000880000-1000889999.
Specifying an explicit runAsUser (like 10000) often falls outside the UID range, triggering SCC violations. Leave these values empty so OpenShift's admission controller automatically assigns appropriate values from the allowed range.
Recommended runAsUser configurations by component
This table outlines the required runAsUser settings for EDB Postgres AI agent components to ensure compatibility with different SCC.
| Component | runAsUser | Reason |
|---|---|---|
| beacon-agent | Empty | Uses restricted SCC; OpenShift assigns UID from namespace range |
| kube-state-metrics | Empty | Uses restricted SCC; OpenShift assigns UID from namespace range |
| opentelemetry-collector | 65532 | Uses privileged SCC for hostPath or hostPorts. |
| opentelemetry-collector | 65532 | Requires explicit numeric UID because runAsNonRoot: true cannot verify non-numeric users like nonroot. Privileged SCC allows any UID, so 65532 works. |
Granting SCC for Daemonsets
To collect node-level metrics and logs on OpenShift, the opentelemetry-collector and prometheus-node-exporter subcharts require elevated permissions to access hostPath, hostPorts, and hostNetwork. Grant the privileged SCC to their respective service accounts using the commands below.
Note
Since OpenShift includes a built-in node-exporter, your deployment may conflict with existing monitoring; consider using the platform's native exporter instead.
Permission setup and deployment
Create the namespace (if not already present):
oc new-project upm-beacon
Grant the privileged SCC:
oc adm policy add-scc-to-user privileged \ system:serviceaccount:upm-beacon:beacon-agent-k8s-opentelemetry-collector oc adm policy add-scc-to-user privileged \ system:serviceaccount:upm-beacon:beacon-agent-k8s-prometheus-node-exporter
Deploy or update the Helm chart:
helm upgrade --install beacon-agent . -f custom-values.yaml -n upm-beacon
Restart the Daemonsets:
kubectl -n upm-beacon rollout restart daemonset beacon-agent-k8s-opentelemetry-collector-agent kubectl -n upm-beacon rollout restart daemonset beacon-agent-k8s-prometheus-node-exporter
Note
On OpenShift, prometheus-node-exporter may conflict with OpenShift's built-in node-exporter.
For example, if port 9100 is already in use.
We recommend setting additionalCharts.prometheus-node-exporter.install: false and relying on the opentelemetry-collector for container metrics via cadvisor/kubelet scraping.
Capping the OTEL collector batch size on OpenShift
On a fully-loaded OpenShift cluster, the per-node kubelet and cAdvisor scrape can produce an OTLP batch larger than the HM metrics receiver's 4 MiB gRPC message limit. When that happens the receiver rejects the batch with ResourceExhausted and every datapoint in it is dropped, so HM shows no CPU, memory, or network metrics even though the collector pods are healthy.
Cap the collector's batch processor so each push stays under the limit:
opentelemetry-collector: config: processors: batch: send_batch_size: 1000 send_batch_max_size: 1500
Or via the command line:
--set 'opentelemetry-collector.config.processors.batch.send_batch_size=1000' \ --set 'opentelemetry-collector.config.processors.batch.send_batch_max_size=1500'