valheim-k8s

https://github.com/Addyvan/valheim-k8s

kubernetes deployment for a valheim game-server. Based off the dockerization work by lloesche here.

Usage

Note: This assumes the node you are running on can use /data/valheim mounted as a host volume for persistence.

helm repo add valheim-k8s https://addyvan.github.io/valheim-k8s/
helm repo update
helm install valheim-server valheim-k8s/valheim-k8s  \
  --set worldName=example-world-name \
  --set serverName=example-server-name \
  --set password=password \
  --set storage.kind=hostvol \
  --set storage.hostvol.path=/data/valheim

Configuration

Parameter Description Default
worldName Prefix of the world files to use (will make new if missing) example-world-name
serverName Server name displayed in the server browser(s) example-server-name
password Server password password
storage.kind Storage strategy/soln used to provide the game-server with persistence hostvol
storage.hostvol.path The folder to be mounted into /config in the game-server pod /data/valheim
networking.serviceType The type of service e.g NodePort, LoadBalancer or ClusterIP LoadBalancer
nodeSelector   {}

Persistence

The only form of persistence currently available is through mounting a hostvol. Please create an issue if you would like support for specific cloud storage solutions via PVCs / storageclasses. They vary by provider so PRs / testers welcome for this.

Using a Host Volume

On the node you wish to use make sure the folder you are mounting exists (ideally empty if you are starting a new world). Once you spin up the game pod you should see the following files created:

$ ls /data/valheim
adminlist.txt  backups  bannedlist.txt  permittedlist.txt  prefs  worlds

Using an existing world

To use an existing world simply set the worldName parameter to the name of your world then save the .db and .fwl files to the directory mounted into the pod. For example, if your world is named myworld then set worldName: myworld in your values file (or --set worldName=myworld) and assuming you are mounting at /data/valheim then your directory should look like:

$ ls /data/valheim/worlds/
myworld.db  myworld.fwl

Connecting to your world

Assuming you have taken care of the networking (port-forwarding if needed, LoadBalancer IP is created, …):

More visual set of instructions here

Potential future updates

If there is interest I can hash out the following: