# Add TLS with cert-manager to a Kubernetes App

Yes. An agent adds an Ingress, a ClusterIssuer and a Certificate for your frontend as a Kustomize component, validates the manifests, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-tls-with-cert-manager/kubernetes/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent starts from how the app is exposed today. In a deployment like GoogleCloudPlatform/microservices-demo, `kubernetes-manifests/frontend.yaml` runs the `frontend` container on port 8080 with liveness and readiness probes on `/_healthz`, and exposes it twice: a `ClusterIP` Service named `frontend` on port 80 and a `LoadBalancer` Service named `frontend-external` on port 80, both targeting 8080. There is no `Ingress` anywhere in `kubernetes-manifests/` or `release/kubernetes-manifests.yaml`; the only TLS termination in the repository is the Istio `Gateway` in `kustomize/components/service-mesh-istio/frontend-gateway.yaml`, which applies only to the mesh variant. `kustomize/kustomization.yaml` includes `base` and lists every component commented out, and `kustomize/components/non-public-frontend/kustomization.yaml` already shows the pattern for removing `frontend-external` with a `$patch: delete`.

The agent adds the feature as one more component, `kustomize/components/tls-ingress`, so nothing changes for anyone who does not opt in. Its `kustomization.yaml` has `kind: Component` and three resources: a `ClusterIssuer` named `letsencrypt` with an ACME `http01` solver on ingress class `nginx`, a `Certificate` named `frontend-tls` for a placeholder host with `secretName: frontend-tls`, and an `Ingress` with the `cert-manager.io/cluster-issuer: letsencrypt` annotation, a `tls` block pointing at that secret, and one rule routing `/` to Service `frontend` port 80. It also carries the same `$patch: delete` for `frontend-external`, because a public `LoadBalancer` beside a TLS Ingress leaves plain HTTP open on a second address. The host and the ACME email are the two values a team has to change, so the component's `README.md` shows the `replacements` or patch that sets them, following the style of `custom-base-url`, which sets `BASE_URL` and rewrites the probe paths with a JSON patch.

Everything the component references is checked against what the cluster needs. The `README.md` says the component expects cert-manager and an NGINX ingress controller installed in the cluster and links the upstream install docs rather than vendoring their manifests, states that the `http01` solver needs the host's DNS to resolve to the ingress controller before the first certificate is issued, and notes that the `frontend` container keeps serving plain HTTP on 8080 behind the Ingress, so the probes on `/_healthz` are unchanged.

Validation follows the repository's own CI. `.github/workflows/kustomize-build-ci.yaml` runs `kubectl kustomize .` in `kustomize/` and then `kustomize build` for every directory under `kustomize/tests/`, which holds `memorystore-with-all-components`, `spanner-with-all-components` and `service-mesh-istio-with-all-components`. The agent adds `kustomize/tests/tls-ingress-with-all-components` so the new component is built on every pull request, runs the same two commands in its sandbox, and runs `kubeconform` with the cert-manager CRD schemas from the CRDs catalog over the output so the `ClusterIssuer` and `Certificate` are checked, not just the core kinds. The output of each command goes in the pull request.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add TLS termination with cert-manager for the frontend of this Kubernetes app. Read kubernetes-manifests/frontend.yaml, kustomize/kustomization.yaml, kustomize/base/kustomization.yaml, the existing components under kustomize/components (especially non-public-frontend and custom-base-url), kustomize/tests and the kustomize-build-ci workflow first. Add a new Kustomize component, tls-ingress, with a ClusterIssuer (ACME http01, ingress class nginx), a Certificate for a placeholder host, and an Ingress that routes to the frontend Service with the cert-manager annotation and a tls block; also delete the frontend-external LoadBalancer in that component. Write a README in the component that says what must be installed in the cluster and how to set the host and email. Add a test directory under kustomize/tests that includes the new component so CI builds it. Run kubectl kustomize on the root and kustomize build on every test directory, and run kubeconform with the cert-manager CRD schemas over the output. Do not touch the Istio or Helm variants. Include the command output and open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request that adds `kustomize/components/tls-ingress/` (`kustomization.yaml`, `cluster-issuer.yaml`, `certificate.yaml`, `ingress.yaml`, `README.md`) and `kustomize/tests/tls-ingress-with-all-components/kustomization.yaml`, and adds one commented line for the new component to `kustomize/kustomization.yaml` beside the others. `kubernetes-manifests/`, `release/`, `helm-chart/` and the Istio component are untouched.

The description quotes the `kubectl kustomize` and `kustomize build` results for the root and every test directory, the `kubeconform` summary naming the CRD schemas it used, and the two values a team must set before applying. The full output is in the transcript at `GET /o/{org}/sessions/{id}/messages`, and `kustomize-build-ci` runs on the pull request.

Before merging, a reviewer sets the real host and email, confirms the ingress class matches the controller in their cluster, and decides whether to use Let's Encrypt's staging endpoint first. A follow-up message to the same session can switch the solver to `dns01` or add a second host.

## Run it on every Linear issue labelled platform

Set up an automation with a Linear trigger on the `platform` label and this prompt, scoped to the Project that holds the manifests. The trigger appends the issue to the prompt, so an issue that names the host and the ingress controller starts a run that writes those values in, builds every overlay, and opens its own pull request.

From your own server, send `POST /o/{org}/sessions` with the repository in `resources` and the issue URL as a second resource, plus a `request_id` that is a UUID v5 of the issue identifier so a retry returns the run already started. The key's `webhook_url` delivers `run.completed` with the `session_url` to read the pull request from.

## Why run it on Rush?

TLS on Kubernetes is three resources that must agree on names, a secret, an annotation and an ingress class, and a mistake only shows up as a certificate that never becomes ready. The agent writes them against the Services that actually exist, builds every Kustomize combination the repository tests, and validates the custom resources against their schemas, in a sandbox with the tools installed.

The pull request carries the built output and the validation results, so a reviewer checks two values and the ingress class rather than applying to a cluster to find out. Several clusters' repositories can be done at once, each in its own sandbox with its own pull request.

## Frequently asked questions

### Does this install cert-manager or the ingress controller?

No. The component assumes both are already in the cluster and its README links the upstream install docs. Vendoring their manifests into an app repository would pin a version the platform team does not own; if you want them in the repository, say so and the agent adds them as separate components.

### What happens to frontend-external?

The component deletes it, the same way `non-public-frontend` does, so the only public path to the frontend is the Ingress with TLS. If you still need the LoadBalancer for a transition, remove that patch from the component's `kustomization.yaml`.

### Why http01 rather than dns01?

An `http01` solver needs nothing but the Ingress and public DNS pointing at it, so it works with any provider. `dns01` needs API credentials for your DNS provider and lets you issue wildcard certificates; a follow-up message can switch the ClusterIssuer if you need that.

### Will the probes or the container change?

No. The `frontend` container keeps listening on 8080 over plain HTTP and the `/_healthz` liveness and readiness probes are unchanged; TLS ends at the ingress controller, which talks to the `frontend` Service on port 80 as before.

### How is the new component tested in CI?

The repository's workflow builds every directory under `kustomize/tests/`, so the agent adds `tls-ingress-with-all-components` there and the next pull request builds it. The agent also runs `kubeconform` with the cert-manager CRD schemas locally, which CI does not do; the pull request says how to add that step if you want it.

## More Kubernetes jobs

- [Add Topology Spread Constraints to Kubernetes Deployments](https://getrush.ai/run/add-topology-spread-constraints/kubernetes/)
- [Add Vertical Pod Autoscaler Recommendations to Kubernetes Deployments](https://getrush.ai/run/add-vertical-pod-autoscaler/kubernetes/)
- [Make Kubernetes Manifests Pass the Restricted Pod Security Standard](https://getrush.ai/run/enforce-pod-security-restricted/kubernetes/)

## More jobs like this: Turn a Linear label into a PR

- [Add Pagination to a Vapor API from a Linear Issue](https://getrush.ai/run/add-todo-pagination/vapor/)
- [Add Logout That Revokes a JWT in FastAPI](https://getrush.ai/run/add-token-revocation/pyjwt/)
- [Show Token Usage per Reply in a Streamlit Chat App](https://getrush.ai/run/add-token-usage-display/streamlit/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
