
# Expose an app with Argo CD

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

Once the controller is [installed with Argo CD](https://cruma.io/book/cruma-tunnels/kubernetes-argocd.md), each app's own Application carries its Ingress or HTTPRoute next to its Deployment and Service. Nothing in the app's Application refers to the controller.

## With an Ingress

Keep the app's manifests in a directory of your repository:

```yaml
# apps/shop/shop.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: shop
spec:
  replicas: 1
  selector:
    matchLabels: {app: shop}
  template:
    metadata:
      labels: {app: shop}
    spec:
      containers:
        - name: shop
          image: nginx:1.27-alpine
          ports:
            - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: shop
spec:
  selector: {app: shop}
  ports:
    - port: 80
      targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: shop
spec:
  ingressClassName: cruma
  rules:
    - host: shop               # shop.<tunnel-id>.tun.cruma-cust1.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: shop
                port:
                  number: 80
```

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

For a per-app install, use `ingressClassName: cruma-<app>` instead.

## With an HTTPRoute

Add the Gateway and the route to the app's directory. The Gateway's class is `cruma`, which the [install](https://cruma.io/book/cruma-tunnels/kubernetes-argocd.md) creates when you include `gatewayclass.yaml`:

```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: web
spec:
  gatewayClassName: cruma
  listeners:
    - name: http
      protocol: HTTP
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: shop
spec:
  parentRefs:
    - name: web
  hostnames:
    - shop-route
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /
      backendRefs:
        - name: shop
          port: 80
```

A hostname is served by Ingresses or by HTTPRoutes, not both. Giving an HTTPRoute a hostname an Ingress already serves leaves the route `Accepted=False` with reason `Conflicted`.

## What Argo CD shows

| Resource | Healthy when | Otherwise |
| --- | --- | --- |
| Ingress | The controller has written the tunnel's address to `status.loadBalancer`. The Application is Progressing until then | Progressing. Nothing serves the Ingress: check that the controller runs and the class matches |
| Gateway | `Programmed` is true | Not Healthy. See the Gateway's conditions |
| HTTPRoute | `Accepted` | Degraded, with the controller's reason in the resource's conditions |

An Ingress the controller can't serve fully still gets the tunnel's address, so Argo CD shows it Healthy. An `Exact` path, an unsupported annotation or a missing backend appears only as a Warning Event on the Ingress, not in Argo CD's health:

```bash
kubectl -n shop describe ingress shop
```

```
Warning  UnsupportedValue  cruma-k8s-gateway  path /health on exact is Exact, which cruma does not support yet; use Prefix
```

The reasons are listed in [Kubernetes ingress](https://cruma.io/book/cruma-tunnels/kubernetes.md). On an HTTPRoute the same message is the `Accepted` condition, so Argo CD shows the route Degraded:

```bash
kubectl -n shop get httproute shop -o jsonpath='{.status.parents[0].conditions}'
```

The address Argo CD shows for the Ingress is your tunnel's hostname, as `kubectl get ingress` shows it. To show another, see [Show another address](https://cruma.io/book/cruma-tunnels/kubernetes.md).

## Troubleshooting

| Symptom | Look at |
| --- | --- |
| Application Synced but Progressing, the Ingress has no address | The controller isn't running, or its class isn't the Ingress's. `kubectl -n cruma-system get pods`, then `kubectl get ingressclass` (or the class your per-app install uses) |
| Ingress is Healthy but the host doesn't answer | `kubectl describe ingress <name>` for Warning Events, then the controller log |
| HTTPRoute Degraded | `kubectl get httproute <name> -o yaml`: the `Accepted` and `ResolvedRefs` conditions name the reason |
| Resource keeps going OutOfSync | Compare the live and desired manifests in Argo CD's diff view. A field another tool writes belongs in `ignoreDifferences` |

---

- Book: [Cruma Tunnels](https://cruma.io/book/cruma-tunnels.md)
- Previous: [Install with Argo CD](https://cruma.io/book/cruma-tunnels/kubernetes-argocd.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)
