> This page is for Remediation Orchestrator.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/remediation-orchestrator/llms.txt.

# Shared K8s

This guide installs the stack on an existing Kubernetes cluster with authentication and
a public URL. NRO and its managed backing services run in a namespace you choose.
Managed backing services are the PostgreSQL, Temporal and telemetry services this stack
installs.

Users open your HTTPS `publicUrl` and sign in through your existing Dex, an OpenID
Connect identity provider. Members of your administrator group have administrator
access.

This guide uses `dev`, the supplied example environment for a shared cluster. It assumes
you already have Dex, an ingress controller, a DNS record and a TLS Secret. `dev` is a
starting point and is not production-ready on its own: configure backups, availability
and capacity for your environment.

Where you can choose differently, the step links to the alternative: an authenticating
proxy or Teleport in place of Dex, or PostgreSQL, Temporal and a collector you already
run.

## Before you start

You need a checkout containing this Helm module. If you do not have one, follow
[Get the checkout](/remediation-orchestrator/deployment/helm#get-the-checkout), then return to this guide from the
Helm module root.

Run the commands from the Helm module root, which contains `helmfile/`. In a clone of
`https://github.com/dsx-ai-factory/remediation-orchestrator.git`, this is the `helm/`
directory. Only the optional image build runs elsewhere, and its step tells you when to
leave and when to return.

Keep the same shell session through image preparation and deployment so the directory
and namespace variables remain available.

Replace `example.org`, `example.invalid` and values in capitals, such as `CONTEXT` and
`DEX_CLIENT_SECRET_FILE`, with your own. Replace the lowercase example names as well: the
namespace `remediation-orchestrator-dev`, the ingress class `nginx`, the TLS Secret
`remediation-orchestrator-tls` and the pull Secret `registry-credentials`.

| Need | Detail |
| --- | --- |
| Tools | Python 3.12 or later, Helm 3.19.4 or later, Helmfile 1.8.1, kubectl and curl. Docker and Bazel to build the image |
| Cluster access | A kubectl context that can manage releases, namespaces and their resources in the target namespace, plus the presync gate permissions below |
| Kubernetes | 1.29 or later when the stack installs the CloudNativePG operator ([support matrix](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/docs/reference/tools.md#support-matrix)) |
| Storage | A default StorageClass, or a named one, that provisions the database volumes |
| Registry | A container registry the cluster can reach, holding a compatible NRO image or ready to receive one |
| Identity | An existing Dex instance where you can register a client. To use an authenticating proxy or Teleport instead, see [Authentication and access](/remediation-orchestrator/deployment/helm/configuration/access) |
| Exposure | An HTTPS origin for `publicUrl`; for the Ingress used here, an ingress controller, a DNS record for the host and a TLS Secret |

A few of these needs have more detail:

- Tools: Helm 4 also works, kubectl must be within one minor version of your API server,
  and curl is only for the optional `/status` check
  ([Tools and compatibility](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/docs/reference/tools.md)). The image build also needs the
  application source checkout's [build prerequisites](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/README.md#prerequisites).
  Bazel is the image build tool.
- Cluster access: the presync gates are scripts Helmfile runs before it installs or
  upgrades a release ([glossary](/remediation-orchestrator/deployment/helm/reference/stack#glossary)). The database presync
  gate needs `pods/exec` in the target namespace. The CNPG operator gate reads
  CustomResourceDefinitions and webhook configurations cluster-wide. It also reads the
  operator Deployment and Endpoints in `cnpg.operatorNamespace`, even when `cnpg.install`
  is `false`. [Security posture](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/DESIGN.md#security-posture) lists every permission
  the gates use. Installing the operator needs permission to create cluster-wide
  resources.
- Storage: not needed when both `database.mode` and `temporal.mode` are `external`
  ([Use existing backing services](/remediation-orchestrator/deployment/helm/configuration/services#use-existing-backing-services)).
- Registry: the cluster must also pull the
  [pinned upstream images](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/helmfile/locks/upstream.lock.json) from `ghcr.io` and
  Docker Hub, and the `helm test` image `curlimages/curl:8.21.0` from Docker Hub.
  Otherwise, set mirrors through `upstreamImages`, `cnpg.expectedImage`,
  `postgresql.image` and `remediation-orchestrator.tests.image`.

The stack does not create the cluster, the registry, Dex, a proxy, the ingress
controller, DNS or certificates.

## 1. Select the cluster

The state file does not name a cluster. `dev` uses the current kubectl context unless you
pass `--kube-context` or set `HELMFILE_KUBE_CONTEXT`. Select the cluster once and clear
those overrides, so Helmfile, Helm and kubectl agree:

```sh
# List the contexts your kubeconfig defines.
kubectl config get-contexts
# Make the target cluster the current context.
kubectl config use-context CONTEXT
# Clear overrides that would send Helmfile or Helm to another cluster.
unset HELMFILE_KUBE_CONTEXT HELM_KUBECONTEXT
```

`use-context` writes your kubeconfig file, so other terminals using that file also switch
to this cluster. To use another kubeconfig file, export `KUBECONFIG=/path/to/config` in
every terminal you use, before selecting the context. Check
`kubectl config current-context` before each `sync` or `destroy`
([Select the cluster](/remediation-orchestrator/deployment/helm/configuration/environments#select-the-cluster)).

## 2. Prepare the image and identity

### Image

This module supplies no published NRO image. If a compatible image is already in a
registry your cluster can reach, note its repository and tag or digest for step 4 and
skip to [Dex sign-in](#dex-sign-in). A compatible image contains `/bin/maestro`, the UI
assets and a `/bin/database-ready` probe that accepts the `--timeout-seconds`,
`--wait-seconds` and `--interval-seconds` flags bootstrap passes.

Otherwise, build and push one. First record the Helm module root so you can return to
it. Then change to the application source root, which contains `cmd/maestro/`. In a
public clone, this is the parent directory:

```sh
# Record the Helm module root while you are in it.
nro_helm_dir="$PWD"
# Change to the application source root.
cd "$nro_helm_dir/.."
```

From the application source root, sign in to your registry and push a Linux amd64 and
arm64 image. Always supply your own repository and an explicit tag:

```sh
# Sign in to your registry.
docker login registry.example.invalid
# Build and push Linux amd64 and arm64 images.
bazel run //cmd/maestro:maestro.image.push -- \
  --repository registry.example.invalid/team/remediation-orchestrator \
  --tag 1.0.0
```

The push also writes the generated tags `0.0.0` and `commit`. Every push overwrites them,
so deploy your explicit tag. The build needs C/C++ toolchains for both Linux
architectures. [Build and publish images](/remediation-orchestrator/deployment/images#build-and-publish-your-image)
covers toolchains, other source layouts and tag stamping.

Return to the Helm module root, where every remaining command runs:

```sh
# Return to the Helm module root.
cd "$nro_helm_dir"
```

### Dex sign-in

NRO signs users in through your existing Dex. Choose the HTTPS origin users will open,
such as `https://remediation-orchestrator.example.org`, as your `publicUrl`. Then, in Dex:

- Register the client `remediation-orchestrator` with redirect URI
  `<publicUrl>/auth/callback`, for example
  `https://remediation-orchestrator.example.org/auth/callback`. Save its client secret
  in a file for step 3.
- Set Dex's issuer to `<publicUrl>/auth/dex`. NRO proxies Dex at `/auth/dex`, so the
  supplied routing needs this issuer. A custom issuer path needs separate proxy routing
  ([dex](/remediation-orchestrator/deployment/helm/reference/application-chart#dex)).
- Set the environment variable `DEX_API_CONNECTORS_CRUD=true` on the Dex server and
  configure at least one connector. The NRO login page lists connectors through Dex's
  gRPC API.
- Keep Dex's plaintext gRPC port on a protected network.

Record two addresses for step 4: Dex's root URL as seen from NRO pods, such as
`http://dex.identity.svc:5556`, and Dex's working gRPC address, such as
`dex.identity.svc:5557`.

To use an authenticating proxy or Teleport instead, follow
[Authenticate through a proxy or Teleport](/remediation-orchestrator/deployment/helm/configuration/access#authenticate-through-a-proxy-or-teleport)
and change these steps:

- In step 3, skip the Dex client Secret.
- In step 4, skip the `auth.dex.*` rows and replace the example's whole `auth` block,
  including `dex:`, with the one from that page.
- In step 4, also skip the Ingress and keep `remediation-orchestrator.ingress.enabled`
  `false`. The chart rejects an Ingress in these modes.
- In step 4, also add the `remediation-orchestrator.networkPolicy` block from that page,
  with `ingressPeers` for your proxy or Teleport agent pods and the `helm test` peer.
- In step 5, skip enabling the Ingress, and sign in through your proxy or Teleport.

## 3. Create the namespace and Secrets

Choose the Kubernetes namespace for this installation and record it once. Every later
command uses it, and the state file's `namespace` must hold the same value:

```sh
# The Kubernetes namespace for this installation; use your own.
nro_namespace=remediation-orchestrator-dev
# Create the namespace.
kubectl create namespace "$nro_namespace"
# Store the Dex client secret from its file.
kubectl -n "$nro_namespace" \
  create secret generic remediation-orchestrator-dex-client \
  --from-file=client-secret=DEX_CLIENT_SECRET_FILE
```

The commands read credentials from files, which keeps them out of command arguments and
shell history. Keep them out of state files and Git as well. Prefer delivering the
Secrets to the cluster through your secret manager. Otherwise, keep each file outside the
checkout and readable only by you.

`DEX_CLIENT_SECRET_FILE` holds only the client secret registered in Dex, with no trailing
newline. In a proxy mode, skip the Dex Secret.

For a private registry, also create a pull Secret from a Docker `config.json` whose
`auths` entry for your registry holds the credentials. A file that only names a
credential helper does not work:

```sh
# Store your registry credentials as a pull Secret.
kubectl -n "$nro_namespace" \
  create secret generic registry-credentials \
  --type=kubernetes.io/dockerconfigjson \
  --from-file=.dockerconfigjson=REGISTRY_CONFIG_JSON
```

`REGISTRY_CONFIG_JSON` is the path to that `config.json` file.

State files hold Secret names, never their contents.

## 4. Write your state file

A state file is a YAML configuration file for one installation. Helmfile uses it to set
the namespace, image, authentication and backing-service choices.

Copy the example to where you manage deployment configuration, outside version control:

```sh
# Create the configuration directory.
mkdir -p "$HOME/.config/remediation-orchestrator"
# Copy the example state file there for editing.
cp helmfile/state-values/dev.example.yaml \
  "$HOME/.config/remediation-orchestrator/dev.yaml"
```

Never save the copy directly in `helmfile/`, because directory-form `-f ./helmfile`
loads every YAML file there as a Helmfile. Helmfile resolves a relative
`--state-values-file` from `helmfile/`, not from your shell, so the commands below pass
a quoted absolute path
([Where to keep your state file](/remediation-orchestrator/deployment/helm/configuration/environments#where-to-keep-your-state-file)).

Open the copy in an editor and set every key below. The render fails while any
`REPLACE_ME` value remains, and reports only the first one it finds. The message comes
at the end of a long template trace, after `error calling fail:`.
[Validation messages](/remediation-orchestrator/deployment/helm/operations/troubleshooting#validation-messages) explains how
to read it.

The example's other values, such as the `candidate` tag, the `dex.identity.svc`
addresses and the administrator group, pass the checks but are placeholders too. The
command below lists the remaining example values. It matches neither `datacenter` nor
`temporal.namespace`, so set those two from the table:

```sh
# Every line this prints still holds an example value.
grep -nE '^[^#]*(REPLACE_ME|candidate|dex\.identity\.svc|remediation-orchestrator-admins|example-provider)' \
  "$HOME/.config/remediation-orchestrator/dev.yaml"
```

Set these keys:

| Key | Set it to |
| --- | --- |
| `namespace` | The value of `$nro_namespace` from step 3, in place of `REPLACE_ME_NAMESPACE` |
| `publicUrl` | The HTTPS origin from step 2, in place of `REPLACE_ME_PUBLIC_URL` |
| `image.repository`, `image.tag` | The repository and tag you pushed or chose in step 2, in place of `REPLACE_ME_IMAGE_REPOSITORY` and `candidate`. For a digest, set `tag: ""` and `digest: sha256:<64 lowercase hex digits>` |
| `storageClass` | A StorageClass name, or `""` for the cluster default, in place of `REPLACE_ME_STORAGE_CLASS` |
| `cnpg.install` | `true` if the cluster has no CloudNativePG operator yet, such as a fresh cluster. Keep the example's `false` only if a cluster-wide operator already exists; otherwise, the first presync gate fails. With an existing operator, also set `cnpg.operatorNamespace`, `cnpg.operatorDeployment` and `cnpg.expectedImage` to its namespace, Deployment name and exact image; the gate fails on any other image ([Use an existing CloudNativePG operator](/remediation-orchestrator/deployment/helm/configuration/services#use-an-existing-cloudnativepg-operator)) |
| `temporal.namespace` | A Temporal namespace unique to this installation, such as `remediation-orchestrator-dev`. This groups workflows inside Temporal; it is separate from the Kubernetes `namespace` above and need not have the same name |
| `auth.siteAdminGroups` | Your administrator group, as Dex reports it in the group claim. To deploy without administrators instead, use an explicit opt-in ([Authorization](/remediation-orchestrator/deployment/helm/reference/application-chart#authorization)) |
| `auth.dex.backendUrl` | Dex's root URL as seen from NRO pods, from step 2 |
| `auth.dex.existingSecret` | The Dex client Secret from step 3, `remediation-orchestrator-dex-client` |
| `auth.dex.grpcAddress` | Dex's working gRPC address, from step 2 |
| `config.toml` | Configuration for the `default` tenant, NRO's configuration and script scope. Set `csp` (cloud service provider hint) and `datacenter` (installation name reported in telemetry); see the [glossary](/remediation-orchestrator/deployment/helm/reference/stack#glossary) |

For a private registry, reference the pull Secret from step 3, so the bootstrap Jobs and
NRO can pull the image:

```yaml
imagePullSecrets:
  - name: registry-credentials
```

### Expose NRO

Setting `publicUrl` does not expose NRO, because the chart's Service is `ClusterIP` and no
route is enabled by default. You publish NRO at the `publicUrl` origin yourself. The
`remediation-orchestrator` passthrough is the state map the stack passes to the NRO chart
as values. In `dex` mode, with your existing ingress controller, add an Ingress through it:

```yaml
remediation-orchestrator:
  ingress:
    enabled: true
    className: nginx
    tlsSecretName: remediation-orchestrator-tls
```

In the proxy and Teleport modes, keep `remediation-orchestrator.ingress.enabled: false`
and skip this Ingress, because the identity layer is the entry point
([Authenticate through a proxy or Teleport](/remediation-orchestrator/deployment/helm/configuration/access#authenticate-through-a-proxy-or-teleport)).

Set `className` to your controller's class. The TLS Secret must already exist in
`$nro_namespace`, and DNS for the `publicUrl` host must point to your ingress controller.
This Ingress routes every path, so `/metrics`, `/status`, `/healthz` and `/readyz` are
reachable without login. Restrict them at the controller, or accept that exposure
deliberately
([Endpoints without authentication](/remediation-orchestrator/deployment/helm/reference/application-chart#endpoints-without-authentication)).

Step 5 offers an optional private `/status` check through a port-forward. To run it
before public exposure, set `remediation-orchestrator.ingress.enabled: false` for the
first render and sync, and enable the Ingress after the check passes.

For a Gateway API route or another exposure, configure it through the same passthrough
([NRO chart values](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/charts/remediation-orchestrator/values.yaml)) or in front of
the Service. Whatever you use must serve the same HTTPS origin as `publicUrl` for
browser login to work.

[State keys](/remediation-orchestrator/deployment/helm/configuration/environments#state-keys) explains every key, and the
other configuration pages cover
[existing PostgreSQL, Temporal or collectors](/remediation-orchestrator/deployment/helm/configuration/services#use-existing-backing-services)
and [chart tuning](/remediation-orchestrator/deployment/helm/configuration/environments#tune-the-charts-through-passthroughs).

## 5. Render, deploy and verify

Render first. This contacts no cluster:

```sh
# Render the manifests to a file for review.
helmfile -f ./helmfile -e dev \
  --state-values-file "$HOME/.config/remediation-orchestrator/dev.yaml" \
  template > /tmp/remediation-orchestrator-dev.yaml
```

Run `sync` only after the render succeeds. Check the `template` command's exit status,
not the file, because a failed `template` still writes the other releases to the file.
Then review the successful output.

A clean render matters because `sync` renders each chart only when it reaches that
release, and the remediation-orchestrator release comes last. An error that only the NRO
chart detects, such as an authentication rule or invalid TOML, would therefore stop
`sync` after the databases, Temporal and the bootstrap migration were applied.

Helmfile installs the pinned chart versions but does not check the archive checksums in
the lock file. Only the Bazel tests check them
([Version pinning](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/DESIGN.md#version-pinning)). To check the archives against the
lock, run `bazel test //...` in the Helm module root on the revision you deploy. That
check needs Bazel ([Prerequisites](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/helm/docs/reference/tools.md#prerequisites)).

`sync` and `destroy` change the cluster. Run them only on a cluster you are authorized
to change.

When you are ready, deploy and check the installation. Run these commands in the
terminal from step 3, where `nro_namespace` is set. In a new terminal, first set
`nro_namespace` to the exact `namespace` value in your state file, and confirm the
context with `kubectl config current-context`.

```sh
# Deploy the stack.
helmfile -f ./helmfile -e dev \
  --state-values-file "$HOME/.config/remediation-orchestrator/dev.yaml" sync
# Show the pods and initialization Jobs.
kubectl -n "$nro_namespace" get pods,jobs
# Run the chart's health test and print its output.
helm -n "$nro_namespace" test remediation-orchestrator --logs
```

Expect the NRO pod and the PostgreSQL, Temporal and collector pods the stack manages to be
`Running` and ready. Two initialization Jobs should be complete, and their pods show
`Completed`:

| Job | Release | Role |
| --- | --- | --- |
| `nro-bootstrap-migrate-<hash>` | `nro-bootstrap` | Applies NRO's database migrations. |
| `nro-bootstrap-temporal-<hash>` | `nro-bootstrap` | Prepares or verifies NRO's Temporal namespace and search attributes. |

With managed Temporal, a third Job, `nro-temporal-schema`, creates or updates the Temporal
server's database schemas as a Helm hook before the Temporal servers start. Helm deletes
it on success, so a successful sync does not list it. A failed one stays for inspection
([Temporal schema migration](/remediation-orchestrator/deployment/helm/configuration/services#temporal-schema-migration)).

With an external Temporal server there is no schema Job. Setting
`temporal.bootstrapJob: false` for that server, which is allowed only with
`temporal.management: verify`, also omits the bootstrap Temporal Job. The migration Job
always runs.

Managed Temporal pods can restart during the first install while the servers initialize.
That is expected, so a nonzero restart count alone is not a failure. If pods keep
restarting, stay unready or pending, or a Job fails, refer to
[Troubleshooting](/remediation-orchestrator/deployment/helm/operations/troubleshooting).

The Helm test requests NRO's `/status` and passes when it returns a successful HTTP
status. NRO answers 503 when its PostgreSQL or Temporal check fails.

You can also check `/status` through a port-forward, without the Ingress. Forward the
port in one terminal and request it from another:

```sh
# Forward the NRO Service to local port 6787.
kubectl -n "$nro_namespace" port-forward svc/remediation-orchestrator 6787:6787
# In a second terminal: request the status endpoint.
curl -fsS http://localhost:6787/status
```

If you left the Ingress disabled for this check, set `enabled: true` after it passes.
Then render and sync again with the same commands before you open `publicUrl`.

Finally, open your `publicUrl`, or your Teleport app, and sign in. Check that your group
claims grant the intended administrator access. To do that, open `/auth/profile` on the
same address. The page shows your user, and the badge `Role: Site Admin` for a member of
`auth.siteAdminGroups`. If a step fails, start with
[Troubleshooting](/remediation-orchestrator/deployment/helm/operations/troubleshooting).

The charts load no user scripts. NRO's internal indexing workflows, `script-indexer` and
`temporal-workflow-indexer`, start on their own with minute-based schedules by default,
so they can appear in Temporal before you add a script.

## Next steps

Follow [Your First Script](/remediation-orchestrator/guides/first-scripts-checklist)
to write, register and run your first script through the UI.
To deliver scripts to this installation afterwards, follow
[Deploy workflow scripts](/remediation-orchestrator/deployment/helm/operations/maintenance#deploy-workflow-scripts).

- Add another installation:
  [Add your own environment](/remediation-orchestrator/deployment/helm/configuration/environments#add-your-own-environment).
- Upgrade the deployment or remove the stack:
  [Upgrade](/remediation-orchestrator/deployment/helm/operations/maintenance#upgrade) and
  [Uninstall](/remediation-orchestrator/deployment/helm/operations/maintenance#uninstall).
- Something failed: [Troubleshooting](/remediation-orchestrator/deployment/helm/operations/troubleshooting).