
# Install with Argo CD

> **🧪 Private preview**
>
> The Kubernetes ingress controller is in private preview. Its manifests and options can change before general availability.

Install the Cruma ingress controller as an Argo CD Application, keep the tunnel credentials out of git, and let Argo CD apply upgrades. This page covers the install. [Expose an app with Argo CD](https://cruma.io/book/cruma-tunnels/kubernetes-argocd-apps.md) covers your own apps, and [Kubernetes ingress](https://cruma.io/book/cruma-tunnels/kubernetes.md) the controller itself.

## What you need

- Argo CD 3.x on the cluster, and a git repository Argo CD can read.
- Argo CD's repo server reaches `files.cruma.io` (and `github.com` for the Gateway API CRDs) over HTTPS. It fetches the install manifests when it renders.
- A tunnel ID and secret from your account.

## Install the controller

Argo CD can't read a manifest from a plain URL, so put a `kustomization.yaml` in your repository that points at the published install file. Pin the version in the path, never `latest`: Argo CD caches a render per git commit, so a moving `latest` would change nothing until you push.

```yaml
# cruma/gateway/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - https://files.cruma.io/files/k8s-gateway/1.0.21/install.yaml
```

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cruma-gateway
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.example.com/acme/platform.git
    targetRevision: main
    path: cruma/gateway
  destination:
    server: https://kubernetes.default.svc
    namespace: cruma-system
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
```

The manifest creates the `cruma-system` Namespace itself, so `CreateNamespace=true` isn't needed. A namespace that already exists, for example one you created to hold the credentials first, is adopted. The Application ends up Synced and Healthy once both replicas are ready.

To use another variant ([LoadBalancer or hostPort](https://cruma.io/book/cruma-tunnels/kubernetes.md)), point the `resources` entry at `install-direct-loadbalancer.yaml` or `install-direct-hostport.yaml`. Those need no tunnel credentials.

## Gateway API CRDs

The install doesn't ship the Gateway API CRDs, and the controller looks for them when it starts. You need them only to serve `HTTPRoute`s. If your cluster already has the v1 standard channel (many distributions install it), skip this. Otherwise add them and the `cruma` GatewayClass to the same kustomization, and order the CRDs first:

```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/standard-install.yaml
  - https://files.cruma.io/files/k8s-gateway/1.0.21/install.yaml
  - https://files.cruma.io/files/k8s-gateway/1.0.21/gatewayclass.yaml
patches:
  - target:
      kind: CustomResourceDefinition
      name: ".*\\.gateway\\.networking\\.k8s\\.io"
    patch: |-
      - op: add
        path: /metadata/annotations/argocd.argoproj.io~1sync-wave
        value: "-1"
```

The wave makes Argo CD wait until the CRDs are established, so the controller starts after them and needs no restart. The Application stays Synced and Healthy.

- In one Application, Argo CD sees that the CRD arrives in the same sync, so `SkipDryRunOnMissingResource=true` isn't needed. The v1.3.0 standard-channel CRDs also apply without `ServerSideApply=true`.
- If another Application installs the CRDs, annotate the GatewayClass, or the sync fails with `Make sure the "GatewayClass" CRD is installed`:

  ```yaml
  patches:
    - target:
        kind: GatewayClass
        name: cruma
      patch: |-
        - op: add
          path: /metadata/annotations
          value:
            argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
  ```

## Keep the tunnel credentials out of git

The controller reads `CRUMA_TUNNEL_ID` and `CRUMA_TUNNEL_SECRET` from a Secret named `cruma-credentials` in its namespace. Argo CD only prunes what it applied, so a Secret created some other way is left alone, and the pods start once it exists. Pick one way to create it. Never commit a real value.

**Sealed Secrets.** Seal the credentials file with `kubeseal` and commit the result:

```bash
cruma tunnel credentials <NAME|ID> --output credentials.yaml \
  --format kubernetes-secret --namespace cruma-system
kubeseal --format yaml < credentials.yaml > cruma/gateway/cruma-credentials.sealedsecret.yaml
rm credentials.yaml
```

Add `cruma-credentials.sealedsecret.yaml` to `resources`. It looks like this (the values are placeholders for `kubeseal`'s output):

```yaml
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
  name: cruma-credentials
  namespace: cruma-system
spec:
  encryptedData:
    CRUMA_TUNNEL_ID: <sealed value>
    CRUMA_TUNNEL_SECRET: <sealed value>
  template:
    metadata:
      name: cruma-credentials
      namespace: cruma-system
```

**External Secrets.** Store the two values in your secret manager and commit only a reference:

```yaml
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: cruma-credentials
  namespace: cruma-system
spec:
  refreshInterval: 1h
  secretStoreRef:
    kind: ClusterSecretStore
    name: platform-secrets
  target:
    name: cruma-credentials
  data:
    - secretKey: CRUMA_TUNNEL_ID
      remoteRef:
        key: cruma/tunnel
        property: id
    - secretKey: CRUMA_TUNNEL_SECRET
      remoteRef:
        key: cruma/tunnel
        property: secret
```

Argo CD shows the ExternalSecret as Progressing until the External Secrets operator has synced it, then Healthy.

**kubectl.** Without a secret tool, create the namespace and the Secret once, outside git, before or after the first sync:

```bash
kubectl create namespace cruma-system
cruma tunnel credentials <NAME|ID> --output credentials.yaml \
  --format kubernetes-secret --namespace cruma-system
kubectl apply -f credentials.yaml && rm credentials.yaml
```

## One install per app namespace

For one controller and tunnel per application namespace, use the Role-only `install-namespaced.yaml` (see [Kubernetes ingress](https://cruma.io/book/cruma-tunnels/kubernetes.md)). It has no namespace of its own, so Argo CD's `destination.namespace` places it. It carries a placeholder identity (`my-app`), and each install needs its own. An ApplicationSet generates the Applications and patches the identity per app:

```yaml
# cruma/namespaced/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - https://files.cruma.io/files/k8s-gateway/1.0.21/install-namespaced.yaml
```

```yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: cruma-gateway-per-app
  namespace: argocd
spec:
  generators:
    - list:
        elements:
          - app: team-a
          - app: team-b
  template:
    metadata:
      name: "cruma-gateway-{{app}}"
    spec:
      project: default
      source:
        repoURL: https://git.example.com/acme/platform.git
        targetRevision: main
        path: cruma/namespaced
        kustomize:
          patches:
            - target:
                kind: Deployment
                name: cruma-k8s-gateway
              patch: |-
                apiVersion: apps/v1
                kind: Deployment
                metadata:
                  name: cruma-k8s-gateway
                spec:
                  template:
                    spec:
                      containers:
                        - name: controller
                          env:
                            - name: CRUMA_K8S_INSTALL_IDENTITY
                              value: "{{app}}"
                            - name: CRUMA_K8S_ACME_STORE
                              value: "{{app}}"
                            - name: CRUMA_K8S_INGRESS_CLASS
                              value: "cruma-{{app}}"
                            - name: CRUMA_K8S_GATEWAY_CONTROLLER
                              value: "cruma.io/{{app}}-gateway-controller"
                            - name: CRUMA_K8S_GATEWAY_CLASS
                              value: "cruma-{{app}}"
      destination:
        server: https://kubernetes.default.svc
        namespace: "{{app}}"
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
```

Each app then uses `ingressClassName: cruma-<app>`. Create each namespace's `cruma-credentials` Secret in that namespace the same way as above. For Gateways, a cluster administrator also needs one GatewayClass per app, which a namespace-only install can't create. Keep them in their own Application:

```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: cruma-team-a
spec:
  controllerName: cruma.io/team-a-gateway-controller
```

A Role-only install watches only its own namespace. Only Pro accepts more than one agent per tunnel, so give each namespace its own tunnel.

## Upgrade and roll back

Change the version in the `resources` path, commit, and let Argo CD sync. The controller image carries the same version tag as the manifest path, so one edit moves both. The Deployment rolls its pods one at a time; each new pod reads your Ingresses and routes again from the cluster. To roll back, revert the commit. With automated sync that is all; otherwise sync the earlier revision from Argo CD's history.

A version that isn't published doesn't break the running install: the Application turns Unknown with a comparison error and keeps what is deployed. See the next section.

## Troubleshooting

| Symptom | Look at |
| --- | --- |
| Application Unknown, `ComparisonError` mentioning `accumulating resources` or `URL is a git repository` | The version in the `resources` path isn't published, or the repo server can't reach `files.cruma.io`. Open the URL from a browser or `curl` it from the repo-server pod |
| Sync fails: `Make sure the "GatewayClass" CRD is installed` | Add `SkipDryRunOnMissingResource=true` to the GatewayClass, see above |
| Deployment Progressing, pods in `CreateContainerConfigError` | The `cruma-credentials` Secret doesn't exist in that namespace yet. Check the SealedSecret or ExternalSecret, or create it with `kubectl` |
| Everything Synced but nothing is served | The controller's own state: `kubectl -n cruma-system logs deploy/cruma-k8s-gateway` and the `TunnelConnected` Event on your Ingress. See [Kubernetes ingress](https://cruma.io/book/cruma-tunnels/kubernetes.md) |
| Resource keeps going OutOfSync | Another tool owns a field Argo CD also sets. Compare the live and desired manifests in the diff view, then add the field to `ignoreDifferences` |

---

- Book: [Cruma Tunnels](https://cruma.io/book/cruma-tunnels.md)
- Previous: [Use instead of ingress-nginx](https://cruma.io/book/cruma-tunnels/kubernetes-ingress-nginx.md)
- Next: [Expose an app with Argo CD](https://cruma.io/book/cruma-tunnels/kubernetes-argocd-apps.md)
- Pages: [Home](https://cruma.io/home.md) · [Docs](https://cruma.io/docs.md) · [Pricing](https://cruma.io/pricing.md) · [Share localhost](https://cruma.io/share-localhost.md) · [Webhook testing](https://cruma.io/webhook-testing.md) · [Homelab](https://cruma.io/homelab.md) · [AI coding agents](https://cruma.io/ai-coding-agents.md) · [Cruma vs ngrok](https://cruma.io/ngrok-alternative.md) · [Cruma vs Cloudflare Tunnel](https://cruma.io/cloudflare-tunnel-alternative.md) · [Blog](https://cruma.io/blog.md)
