Replaces the static Secret with an ExternalSecret that pulls password, server_name and world_name from valheim/server in the openbao ClusterSecretStore. server.name, server.worldName and server.password are removed from values. The StatefulSet is annotated for Stakater Reloader so the pod restarts when the secret changes. Co-Authored-By: Claude Sonnet 5 <[email protected]>
70 lines
2.8 KiB
Markdown
70 lines
2.8 KiB
Markdown
# valheim-gitops
|
|
|
|
Helm chart to run a [Valheim](https://www.valheimgame.com/) dedicated server on Kubernetes,
|
|
using the community [`lloesche/valheim-server`](https://github.com/lloesche/valheim-server-docker)
|
|
image.
|
|
|
|
## What's included
|
|
|
|
- **Namespace** (`valheim` by default, toggle with `namespace.create`)
|
|
- **StatefulSet** running the game server with a persistent volume for world data
|
|
(`/config` and `/opt/valheim`) so the world survives restarts/upgrades
|
|
- **ExternalSecret** that pulls the server name, world name and join password
|
|
(`SERVER_NAME`, `WORLD_NAME`, `SERVER_PASS`) from OpenBao via the `openbao`
|
|
`ClusterSecretStore` into a Secret named `valheim-server`
|
|
- **Service** (`NodePort` by default) exposing the game (2456/udp), query (2457/udp)
|
|
and crossplay (2458/udp) ports
|
|
- Headless **Service** for the StatefulSet
|
|
|
|
## Configuration
|
|
|
|
See [`values.yaml`](values.yaml) for all options. Important ones:
|
|
|
|
| Key | Description | Default |
|
|
|---|---|---|
|
|
| `externalSecret.storeName` / `externalSecret.storeKind` | Secret store the `ExternalSecret` reads from | `openbao` / `ClusterSecretStore` |
|
|
| `externalSecret.remoteKey` | Path of the secret in the store's KV v2 mount | `valheim/server` |
|
|
| `externalSecret.properties.*` | Property names inside that secret (`password`, `serverName`, `worldName`) | `password`, `server_name`, `world_name` |
|
|
| `externalSecret.refreshInterval` | How often ESO re-reads OpenBao | `1h` |
|
|
| `service.type` | `NodePort` or `LoadBalancer` | `NodePort` |
|
|
| `persistence.storageClassName` | StorageClass for world data, empty = cluster default | `""` |
|
|
| `persistence.size` | Size of the world data volume | `10Gi` |
|
|
|
|
## Secrets (OpenBao)
|
|
|
|
Server name, world name and join password are not stored in git. Create them in
|
|
OpenBao (KV v2 mount `secret/`) at `valheim/server` with the keys `password`,
|
|
`server_name` and `world_name`:
|
|
|
|
```sh
|
|
bao kv put secret/valheim/server \
|
|
password=<join-password> server_name=<name> world_name=<world>
|
|
```
|
|
|
|
Requirements: the `openbao` `ClusterSecretStore` must be `Ready` (OpenBao unsealed,
|
|
see the `openbao` chart) and its role must be allowed to read `secret/data/valheim/*`
|
|
(the default `eso-read` policy covers all of `secret/data/*`).
|
|
|
|
Environment variables are read when the container starts. After changing a value in
|
|
OpenBao, ESO updates the Secret at the next refresh, but you must restart the pod for
|
|
the server to pick it up:
|
|
|
|
```sh
|
|
kubectl -n valheim rollout restart statefulset/valheim
|
|
```
|
|
|
|
Note: changing `world_name` makes the server load/create a different world.
|
|
|
|
## Usage
|
|
|
|
```sh
|
|
helm upgrade --install valheim . -n valheim --create-namespace
|
|
```
|
|
|
|
### Deploying via ArgoCD
|
|
|
|
This repository is intended to be deployed as an ArgoCD `Application` using this
|
|
chart as the Helm source (see `apps-in-apps` repo for the bootstrap Application).
|
|
|
|
> Never commit real passwords to git - keep them in OpenBao.
|