# Helm chart

> Install Stackable Cockpit with its Helm chart and configure ingress, reverse proxy headers, CA certificates and the scratch volume.

The Helm chart deploys Cockpit. It does not deploy PostgreSQL, the OIDC provider or Trino. The chart is published to `oci.stackable.tech/sdp-charts/cockpit` and `quay.io/stackable/sdp-charts/cockpit`. Each chart pulls the image from the registry it comes from. The [chart README](https://github.com/stackabletech/cockpit/blob/release-26.11/deploy/helm/cockpit/README.md) lists all values.

```console
$ helm install cockpit oci://oci.stackable.tech/sdp-charts/cockpit --version 26.11.0 --values cockpit-values.yaml
```

To install from quay.io instead:

```console
$ helm install cockpit oci://quay.io/stackable/sdp-charts/cockpit --version 26.11.0 --values cockpit-values.yaml
```

## Ingress and reverse proxy

> **Important:** Cockpit must be served over HTTPS, because session cookies and credentials such as S3 keys pass through the browser connection. Cockpit itself serves plain HTTP, so terminate TLS at the Ingress or reverse proxy and use `https://` URLs for `origin` and `auth.baseUrl`.

The chart creates a ClusterIP Service on port 3000 and can create an Ingress with the `ingress` values.

Cockpit must be served at the root path `/` of its host, for example `[https://cockpit.example.com/](https://cockpit.example.com/)`. Other base paths such as `[https://example.com/cockpit/](https://example.com/cockpit/)` are not supported, so do not route a path prefix to Cockpit or rewrite paths in the Ingress or reverse proxy.

Set `origin` to the URL users open in the browser. Behind a reverse proxy, also set the forwarded headers Cockpit trusts:

```yaml
origin: https://cockpit.example.com
proxy:
  protocolHeader: x-forwarded-proto
  hostHeader: x-forwarded-host
```

### Response header size

Pages send a `Link` header that preloads their JavaScript and CSS. It grows with the number of files a page loads and exceeds 4 KB on some pages. Proxies with a smaller header buffer answer these pages with `502 Bad Gateway`, for example ingress-nginx and nginx with their default `4k` buffer. Raise the buffer to 16 KB:

```yaml
ingress:
  enabled: true
  className: nginx
  annotations:
    nginx.ingress.kubernetes.io/proxy-buffer-size: "16k"
```

For plain nginx, set `proxy_buffer_size 16k;` and `proxy_busy_buffers_size 16k;`.

### Request body size

The storage browser uploads each file in a single request of up to `config.bodySizeLimit` (default `5G`). Proxies with a smaller body limit answer larger uploads with `413 Payload Too Large`, for example ingress-nginx and nginx with their default `1m`. Raise the limit to match, and stream uploads instead of buffering them on the proxy’s disk first:

```yaml
ingress:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "5g"
    nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
```

For plain nginx, set `client_max_body_size 5g;` and `proxy_request_buffering off;`.

An upload must also finish within `config.requestTimeout` seconds (default `3600`, so 5 GB need about 12 Mbit/s). The nginx timeouts `client_body_timeout` and `proxy_send_timeout` only limit the time between two reads or writes, so their defaults don’t cut off long uploads.

## CA certificates

For an OIDC provider or backends with a private CA, add its CA certificate from a SecretClass or a mounted file:

```yaml
tls:
  secretClasses:
    - tls (1)
  caCerts:
    - /stackable/database-ca/ca.crt (2)
extraVolumes:
  - name: database-ca
    secret:
      secretName: database-ca
extraVolumeMounts:
  - name: database-ca
    mountPath: /stackable/database-ca
    readOnly: true
```

(1) The Secret Operator mounts the CA certificate of the SecretClass.
(2) A CA file mounted from a Secret.

Cockpit trusts these CAs for all outgoing TLS connections, in addition to the public CAs bundled with Node.js. They are not tied to a service: a CA added for Trino is also trusted for the OIDC provider, PostgreSQL and S3. Only add CAs you trust for all of them.

Cockpit does not start if a CA file is missing or invalid.

## Additional environment variables

To set [environment variables](https://docs.stackable.tech/home/stable/cockpit/reference/environment-variables/index.md) directly, use `extraEnv` or `extraEnvFrom`:

```yaml
extraEnv:
  - name: LOG_LEVEL
    value: debug
```

## Scratch volume

The chart mounts an emptyDir at `/tmp` for the archive preview cache. Keep `tmp.sizeLimit` above `storage.archiveCacheMaxMb`, otherwise the kubelet evicts the pod when the cache fills up:

```yaml
tmp:
  sizeLimit: 1Gi
storage:
  archiveCacheMaxMb: 512
```

## Replicas

Cockpit keeps running queries in memory, so keep `replicaCount` at `1`.
