|
| 1 | +## Bring your own cluster (remote deployments) |
| 2 | + |
| 3 | +This guide explains how to deploy application workloads to a remote OpenShift cluster while keeping Tekton Pipelines and webhooks on the host (RHDH) cluster. The GitOps application is split into two Argo CD apps: |
| 4 | + |
| 5 | +- app: Deploys the application manifests to the destination cluster (host or remote) |
| 6 | +- app-tekton: Manages Tekton resources on the host cluster so all PipelineRuns execute there |
| 7 | + |
| 8 | +### High-level behavior |
| 9 | +- Tekton webhooks and PipelineRuns stay on the host cluster. |
| 10 | +- When a remote cluster is selected, only the application runtime resources deploy to the remote cluster. |
| 11 | +- The same namespace name is used on both clusters. For the initial iteration, choosing different namespaces across clusters is not supported. |
| 12 | + |
| 13 | +### Who should use this |
| 14 | + |
| 15 | +#### Platform Engineers |
| 16 | +- Configure the remote cluster in the dynamic plugins (Topology and Kubernetes) so RHDH can read cluster resources. |
| 17 | +- Register the remote cluster in Argo CD on the host cluster via a cluster secret. |
| 18 | +- Ensure the remote namespace is prepared with required secrets/permissions or provide a bootstrap mechanism. |
| 19 | + |
| 20 | +#### Application Engineers |
| 21 | +- Use the Software Template wizard to select Remote cluster deployment. |
| 22 | +- Provide the remote cluster API URL (must match the Argo CD cluster `server`). |
| 23 | +- Provide the namespace to deploy into (same name will be used on host for Tekton PipelineRuns). |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | +- Two OpenShift clusters: |
| 29 | + - Host cluster: runs RHDH, Argo CD, Tekton |
| 30 | + - Remote cluster: receives the application deployment |
| 31 | +- CLI access: `oc`/`kubectl` authenticated to both clusters, `ArgoCD` CLI |
| 32 | +- Versions: RHDH 1.8 with OCP 4.17 |
| 33 | +- If deploying RHOAI-based apps on the remote cluster, install: |
| 34 | + - Node Feature Discovery (with a `NodeFeatureDiscovery` CR) |
| 35 | + - NVIDIA GPU Operator (with a `ClusterPolicy` CR) |
| 36 | + - OpenShift AI Operator (with a `DataScienceCluster` CR) |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Step 1: Expose the remote cluster to RHDH UI via dynamic plugins (Topology/Kubernetes) |
| 41 | + |
| 42 | +Before installing/configuring RHDH using the ai-rhdh-installer, add the remote cluster to the installer’s dynamic plugin configuration so the Topology and Kubernetes plugins can read it. |
| 43 | + |
| 44 | +On the remote cluster, create a service account and bind permissions: |
| 45 | + |
| 46 | +#### Create a service account token |
| 47 | + |
| 48 | + |
| 49 | +Permanent, non-expiring service account token to view: |
| 50 | + |
| 51 | +- Kubernetes: Manually create a Secret for a Service Account — `https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#manually-create-a-secret-for-a-service-account` |
| 52 | +- Backstage: Kubernetes configuration — `https://backstage.io/docs/next/features/kubernetes/configuration/` |
| 53 | + |
| 54 | + |
| 55 | +```bash |
| 56 | +oc create serviceaccount rhdh-sa -n default |
| 57 | + |
| 58 | +# Grant read-only access cluster-wide |
| 59 | +oc create clusterrolebinding rhdh-sa-view \ |
| 60 | + --clusterrole=view \ |
| 61 | + --serviceaccount=default:rhdh-sa |
| 62 | + |
| 63 | +# Create a Secret that yields a permanent token |
| 64 | +cat <<'EOF' | oc apply -f - |
| 65 | +apiVersion: v1 |
| 66 | +kind: Secret |
| 67 | +metadata: |
| 68 | + name: rhdh-sa-token |
| 69 | + namespace: default |
| 70 | + annotations: |
| 71 | + kubernetes.io/service-account.name: rhdh-sa |
| 72 | +type: kubernetes.io/service-account-token |
| 73 | +EOF |
| 74 | + |
| 75 | +# Retrieve and print the token |
| 76 | +oc get secret rhdh-sa-token -n default -o jsonpath='{.data.token}' | base64 --decode |
| 77 | +``` |
| 78 | + |
| 79 | +Add a cluster entry to the installer’s plugin config. Example shapes for cluster locator configuration: |
| 80 | + |
| 81 | +Minimal entry (used by some dynamic plugins): |
| 82 | + |
| 83 | +```yaml |
| 84 | +- authProvider: serviceAccount |
| 85 | + name: <remote-cluster-name> |
| 86 | + serviceAccountToken: <paste-token-here> |
| 87 | + skipTLSVerify: true |
| 88 | + url: https://api.<your-remote-cluster>. |
| 89 | +``` |
| 90 | +
|
| 91 | +Full Backstage Kubernetes backend plugin config using `clusterLocatorMethods`: |
| 92 | + |
| 93 | +```yaml |
| 94 | +pluginConfig: |
| 95 | + kubernetes: |
| 96 | + serviceLocatorMethod: |
| 97 | + type: multiTenant |
| 98 | + clusterLocatorMethods: |
| 99 | + - type: config |
| 100 | + clusters: |
| 101 | + - url: https://api.<remote-cluster>:443 |
| 102 | + name: <remote-cluster-name> |
| 103 | + authProvider: serviceAccount |
| 104 | + serviceAccountToken: ${K8S_SA_TOKEN} |
| 105 | + skipTLSVerify: true |
| 106 | + # Your remote cluster info goes here |
| 107 | + customResources: |
| 108 | + - group: route.openshift.io |
| 109 | + apiVersion: v1 |
| 110 | + plural: routes |
| 111 | + - group: tekton.dev |
| 112 | + apiVersion: v1 |
| 113 | + plural: pipelineruns |
| 114 | + - group: tekton.dev |
| 115 | + apiVersion: v1 |
| 116 | + plural: taskruns |
| 117 | +``` |
| 118 | + |
| 119 | +Notes: |
| 120 | +- For more options (e.g., `catalog`, `gke`, metrics, dashboards), see the Backstage docs: [Backstage Kubernetes configuration](https://backstage.io/docs/next/features/kubernetes/configuration/). |
| 121 | +- Avoid storing tokens in catalog annotations; prefer the config locator method with `serviceAccountToken`. |
| 122 | + |
| 123 | +Then proceed with the installer’s configure step to apply changes. |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +## Step 2: Register the remote cluster in Argo CD (host cluster) |
| 128 | +Argo CD must know how to reach the remote cluster to deploy the application there. You can register the cluster either via the Argo CD CLI (recommended) or by creating a cluster Secret (manual). |
| 129 | + |
| 130 | +### Register via Argo CD CLI |
| 131 | + |
| 132 | +```bash |
| 133 | +# 1) Inspect kubeconfig contexts on your workstation |
| 134 | +kubectl config get-contexts |
| 135 | +
|
| 136 | +# 2) Use the remote cluster context and verify access |
| 137 | +kubectl config use-context <remote-cluster-context-name> |
| 138 | +kubectl get nodes |
| 139 | +
|
| 140 | +# 3) Ensure you're logged into the remote cluster with oc (OpenShift) |
| 141 | +# If not logged in, authenticate with a token (adjust flags as needed) |
| 142 | +oc whoami || oc login https://api.<remote-cluster>:443 |
| 143 | +
|
| 144 | +# 4) Log into Argo CD (host cluster) |
| 145 | +# Use --insecure if you don't have a valid TLS cert; add --sso if SSO is enabled |
| 146 | +argocd login <argocd-url> |
| 147 | +
|
| 148 | +# 5) Register the remote cluster with Argo CD using its kubeconfig context |
| 149 | +argocd cluster add <remote-cluster-context-name> |
| 150 | +
|
| 151 | +# 6) Verify Argo CD sees the cluster |
| 152 | +argocd cluster list |
| 153 | +``` |
| 154 | + |
| 155 | +### Rotate the Argo CD bearer token for an external cluster |
| 156 | + |
| 157 | +```bash |
| 158 | +# Run against the external cluster's kubeconfig context |
| 159 | +kubectl config use-context <remote-cluster-context-name> |
| 160 | +
|
| 161 | +# Delete the argocd-manager token secret so a new one is created |
| 162 | +kubectl delete secret argocd-manager-token-XXXXXX -n kube-system |
| 163 | +
|
| 164 | +# Re-add the cluster to rotate credentials |
| 165 | +argocd cluster add <remote-cluster-context-name> |
| 166 | +``` |
| 167 | + |
| 168 | +See: [Argo CD — External cluster credentials](https://argo-cd.readthedocs.io/en/stable/operator-manual/security/#external-cluster-credentials) |
| 169 | + |
| 170 | + |
| 171 | +## Step 4: Generate and import the template |
| 172 | +- Regenerate templates in your fork if needed: |
| 173 | + |
| 174 | +- Import the updated template into RHDH. |
| 175 | +- In the template wizard, select Remote cluster deployment and provide the remote API URL that matches the Argo CD secret `server` value. |
| 176 | +- Choose the target namespace (same name will be used on the host for Tekton PipelineRuns). |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## Validation |
| 181 | +- Topology/Kubernetes plugins show the remote cluster’s resources |
| 182 | +- Argo CD has two apps: |
| 183 | + - `app` targets the remote cluster and syncs application workloads |
| 184 | + - `app-tekton` targets the host cluster and manages Tekton resources |
| 185 | +- PipelineRuns execute on the host cluster; workloads appear on the remote namespace |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +## Notes and limitations |
| 190 | +- Same namespace name on host and remote is required for this iteration. |
| 191 | +- Multiple remote namespaces per template are out of scope and may require future enhancements. |
| 192 | +- This feature is evolving; comprehensive end-user documentation improvements are being tracked upstream. |
0 commit comments