# Kubernetes and Helm

The Helm chart **`crushmft27`** runs CrushMFT 27 in Kubernetes: one server in a StatefulSet, its data on a PersistentVolumeClaim, the first admin's password in a Secret, settings as a ConfigMap. It uses the same image as Docker and starts it the same way ([How it works](How-It-Works.md)): no init container, no job, no shell, a read-only root file system.

## Get the chart

<!-- DOWNLOAD-LINK: crushmft27 goes into https://crushftp.com/charts with CrushMFT 27's release; it was taken out again on 2026-11-21 (v27 not released). The commands below are right from then on. -->
The chart is in CrushFTP's chart repository, `https://crushftp.com/charts`, next to CrushFTP 11's chart `crushftp`:

```
helm repo add crushftp https://crushftp.com/charts
helm repo update
helm search repo crushftp/crushmft27
helm show values crushftp/crushmft27        # every value with its comment
```

Helm 3 and Helm 4 both work.

| Chart | Image | Kubernetes |
|---|---|---|
| `crushmft27` 0.1.0 | `crushftp/crushmft27`, default tag `latest` (tested with `27.0.0_289`) | 1.25 or later, a StorageClass for ReadWriteOnce volumes |

## Install

```
helm install crushmft27 crushftp/crushmft27 -n crushftp --create-namespace
kubectl -n crushftp rollout status statefulset/crushmft27
kubectl -n crushftp get secret crushmft27-initial-password -o jsonpath='{.data.password}' | base64 -d; echo
kubectl -n crushftp port-forward svc/crushmft27 8080:8080
```

Open `http://127.0.0.1:8080/`, sign in as `crushadmin` with the password the third line printed, and change it. The first start takes some seconds to a minute; the pod is ready when the server is.

The names below assume the release name `crushmft27` (the chart's objects are then called `crushmft27`, `crushmft27-0`, `crushmft27-initial-password`, `app-volume-crushmft27-0`). With another release name they are `<release>-crushmft27...`.

## What it creates

| Object | Name | What |
|---|---|---|
| StatefulSet | `crushmft27` | one pod, `crushmft27-0` |
| PersistentVolumeClaim | `app-volume-crushmft27-0` | the working folder `/app/CrushMFT27`, 5 Gi |
| Secret | `crushmft27-initial-password` | the first admin's password, 20 random characters, made once |
| ConfigMap | `crushmft27-configmap` | settings as `split_prefs` files, mounted read-only at `/app/CrushMFT27/split_prefs` |
| Service | `crushmft27` | ClusterIP with 8080, 9090, 443, 2222, 21 |
| ServiceAccount | `crushmft27` | no rights, its token not mounted |
| HTTPRoute | `crushmft27` | only with `httpRoute.enabled` |

The pod runs as uid 65532 (`fsGroup` 65532), with every capability dropped, no privilege escalation and a read-only root (`/tmp` is an emptyDir). The probes use `/WebInterface/api/readyz` and `/WebInterface/api/healthz`, which answer without a login and make no session.

## Values

| Value | Default | What it does |
|---|---|---|
| `image.repository` | `crushftp/crushmft27` | the image; your registry's copy if you mirror it |
| `image.tag` | `latest` | pin a build in production, e.g. `27.0.0_289` |
| `image.pullPolicy` | `Always` | right for `latest`; `IfNotPresent` with a pinned tag |
| `imagePullSecrets` | none | for a private registry |
| `license.name`, `license.email`, `license.code` | none | the licence, written as split_prefs files (the name is URL-encoded for you). Without it: a 30 day trial. |
| `adminPassword.existingSecret` | empty | a Secret of yours with the first admin's password; the chart then makes none |
| `adminPassword.existingSecretKey` | `password` | the key in that Secret |
| `args` | `-ad crushadmin` | CrushMFT's arguments. `[-ad, admin]` names the first admin `admin`. |
| `extraEnv` | none | more environment variables ([Configuration](Configuration.md#environment-variables)), e.g. `TZ` |
| `javaOptions` | none | Java options instead of the image's heap setting; the container then starts as `java <javaOptions> -Dcrushmft.image=/app -jar /app/container/CrushContainer.jar` |
| `command` | none | replaces the whole start; leave it empty |
| `inAppUpdater` | `true` | CrushMFT's updater. `false` turns the automatic update check off ([Updates and versions](Updates-and-Versions.md)). |
| `fips.enabled` | `false` | FIPS 140-3 mode: the `-fips` image of the same tag (`27.0.0_289` runs as `27.0.0_289-fips`), started with `-Dcrushmft.fips=true` ([Images and tags](Images.md#fips-140-3-mode)) |
| `fips.prepare` | `true` | with `fips.enabled`: the image prepares the volume for FIPS mode before a start of a new version |
| `fips.secretKey.existingSecret`, `.existingSecretKey` | none, `secret.key` | with `fips.enabled`: the server's key for stored secrets from a Secret of yours, mounted read-only at `/app/CrushMFT27/secret.key`. Without it the key is made on the volume: back it up apart from the volume. |
| `config.logging.debug` | `"0"` | log level: `0` normal, `1` debug, `2` verbose |
| `split_prefs` | none | more settings, `file name: content` ([Configuration](Configuration.md#settings-as-files-split_prefs)) |
| `persistence.enabled` | `true` | `false` uses an emptyDir: the data goes with the pod |
| `persistence.size` | `5Gi` | the volume's size (settings, users, logs, the program and a few kept versions; not your users' files unless you put them there) |
| `persistence.storageClassName` | the cluster's default | |
| `persistence.accessModes` | `[ReadWriteOnce]` | |
| `persistence.annotations`, `.labels` | none | on the claim |
| `extraVolumes`, `extraVolumeMounts`, `extraVolumeClaimTemplates` | none | more volumes, e.g. for the users' files |
| `service.type` | `ClusterIP` | `LoadBalancer` or `NodePort` to reach SFTP and FTP from outside |
| `service.ports` | 8080, 9090, 443, 2222, 21 | the Service's ports (`name`, `port`, `targetPort`, `protocol`) |
| `service.sessionAffinity` | `ClientIP` | |
| `httpRoute.enabled`, `.parentRefs`, `.hostnames`, `.rules` | off | a Gateway API HTTPRoute to port 8080 |
| `resources` | 2Gi memory (request and limit), 250m CPU request | the server's heap is half of the memory limit |
| `startupProbe`, `livenessProbe`, `readinessProbe` | readyz / healthz on 8080 | the startup probe allows 5 minutes |
| `terminationGracePeriodSeconds` | `120` | how long a stop may take (jobs and transfers finish first) |
| `podSecurityContext` | `fsGroup: 65532`, `fsGroupChangePolicy: OnRootMismatch` | add `sysctls` here for ports below 1024 ([Ports and networking](Ports-and-Networking.md#ports-below-1024)) |
| `securityContext` | uid 65532, gid 0, read-only root, no capabilities | |
| `serviceAccount.create`, `.name`, `.annotations` | create, no rights | |
| `podAnnotations` | none | |
| `nodeSelector`, `tolerations`, `affinity` | none | |
| `extraManifests` | none | more objects rendered with the release (an Ingress, a second Service, ...) |
| `replicaCount` | `1` | keep 1 (below) |

## Examples

A values file, `crushmft27.yaml`, used with `helm install ... -f crushmft27.yaml`:

```yaml
image:
  tag: "27.0.0_289"
  pullPolicy: IfNotPresent

license:
  name: Example Corp
  email: it@example.com
  code: "XXXX-XXXX-XXXX"

extraEnv:
  - name: TZ
    value: Europe/Berlin

persistence:
  size: 10Gi
  storageClassName: fast-ssd

resources:
  limits:
    memory: 4Gi
  requests:
    cpu: "1"
    memory: 4Gi

service:
  type: LoadBalancer      # HTTP, HTTPS and SFTP on the load balancer's address
```

**Your own admin password:**

```
kubectl -n crushftp create secret generic crushftp-admin --from-literal=password='...'
helm install ... --set adminPassword.existingSecret=crushftp-admin
```

**The updater off, a fixed port list:**

```yaml
inAppUpdater: false
split_prefs:
  _log_debug_level.txt: "1"
  _server_list.xml: |
    <server_list type="vector"> ... copied from prefs.XML ... </server_list>
```

**The users' files on a shared volume:**

```yaml
extraVolumes:
  - name: files
    persistentVolumeClaim:
      claimName: crushftp-files      # an existing claim, writable by uid 65532
extraVolumeMounts:
  - name: files
    mountPath: /files                # point the users' virtual folders at /files/...
```

**Web traffic through an Ingress** (with SFTP on its own load balancer):

```yaml
service:
  type: LoadBalancer
  ports:
    - { name: sftp, port: 22, targetPort: 2222, protocol: TCP }
extraManifests:
  - apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: crushmft27-web
      annotations:
        nginx.ingress.kubernetes.io/proxy-body-size: "0"      # no upload size limit
        nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    spec:
      ingressClassName: nginx
      tls:
        - hosts: [files.example.com]
          secretName: files-example-com-tls
      rules:
        - host: files.example.com
          http:
            paths:
              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: crushmft27-web
                    port: { number: 8080 }
  - apiVersion: v1
    kind: Service
    metadata:
      name: crushmft27-web
    spec:
      selector:
        app.kubernetes.io/name: crushmft27
        app.kubernetes.io/instance: crushmft27
      ports:
        - { name: http, port: 8080, targetPort: 8080 }
```

Turn on the trusted proxy headers in CrushMFT's HTTP port settings, so it sees the clients' addresses ([Ports and networking](Ports-and-Networking.md#https-and-certificates)).

## Upgrade

A newer CrushMFT: change the tag.

```
helm upgrade crushmft27 crushftp/crushmft27 -n crushftp --reuse-values --set image.tag=27.0.0_290
```

With `latest` and `pullPolicy: Always`, a restart takes the newest image: `kubectl -n crushftp rollout restart statefulset/crushmft27`.

The pod restarts, the image's newer version is put into the volume and runs; the version before stays there to go back to. An in-app update that is newer than the image keeps running ([Updates and versions](Updates-and-Versions.md)). A change to the licence, `split_prefs` or `config` rolls the pod too (the ConfigMap's checksum is part of the pod).

## Uninstall

```
helm uninstall crushmft27 -n crushftp
```

The volume claim and the password Secret **stay**, so a new install with the same release name finds its data and password again. To delete everything:

```
kubectl -n crushftp delete pvc app-volume-crushmft27-0
kubectl -n crushftp delete secret crushmft27-initial-password
```

## Day to day

| | |
|---|---|
| The log | `kubectl -n crushftp logs crushmft27-0 -f` |
| Restart | `kubectl -n crushftp rollout restart statefulset/crushmft27`. A restart asked for in the admin pages ends the container and Kubernetes starts it again. |
| Thread dump | `kubectl -n crushftp exec crushmft27-0 -- jcmd 1 Thread.print` |
| A shell | set `image.tag` to the `-dev` tag (e.g. `latest-dev`), then `kubectl -n crushftp exec -it crushmft27-0 -- bash` |
| Is it ready | `kubectl -n crushftp get pod crushmft27-0`; inside the cluster `http://crushmft27.crushftp:8080/WebInterface/api/readyz` |
| A lost admin password | [Operations](Operations.md#reset-the-admin-password) |

## One replica

The chart runs one server. A second replica would share nothing with the first: each would have its own volume, users and settings. Several CrushMFT servers serving the same users are CrushMFT's cluster (Enterprise), which this chart version does not set up. Keep `replicaCount: 1`.

## CrushFTP 11

CrushFTP 11 has its own chart, `crushftp`, in the chart repository `https://crushftp.com/charts` ([CrushFTP 11 images](CrushFTP-11.md)). The two charts are separate; a CrushFTP 11 release is not upgraded to CrushMFT 27 by changing the chart.
