stardew-valley-server

by cabrera-evil

Helm chartv0.1.0App latestVerified publisher

Helm chart for deploying Stardew Valley dedicated game server

About this chart

Stardew Valley Dedicated Server Helm Chart

Official Helm chart for deploying a Stardew Valley multiplayer dedicated server on Kubernetes.

TL;DR

helm repo add cabrera-evil https://cabrera-evil.github.io/charts/
helm install my-stardew cabrera-evil/stardew-valley-server \
  --set gameServer.steamCredentials.username=YOUR_STEAM_USER \
  --set gameServer.steamCredentials.password=YOUR_STEAM_PASS \
  --set gameServer.vncPassword=YOUR_VNC_PASS

Introduction

This chart deploys a Stardew Valley dedicated game server using the SDVD server image.

Features

  • UDP service exposure via LoadBalancer/NodePort
  • Persistent game saves and configuration with dual PVC architecture
  • Automatic Steam authentication
  • Health monitoring with process-based checks
  • Resource management and limits
  • VNC support for server management
  • Backup-friendly dual PVC architecture
  • Automatic pod restart on configuration changes

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0+
  • PV provisioner support in the underlying infrastructure
  • Steam account that owns Stardew Valley
  • For LoadBalancer: Cloud provider with load balancer support

Installing the Chart

Basic Installation

helm install my-stardew cabrera-evil/stardew-valley-server \
  --set gameServer.steamCredentials.username=mysteamuser \
  --set gameServer.steamCredentials.password=mysteampass \
  --set gameServer.vncPassword=myvncpass

Using values file (RECOMMENDED)

Create my-values.yaml:

gameServer:
  steamCredentials:
    username: "mysteamuser"
    password: "mysteampass"
    guardCode: "AB123"  # If 2FA enabled
  vncPassword: "secure-password"

service:
  type: LoadBalancer

persistence:
  gameData:
    size: 20Gi  # Increase if using mods

Install:

helm install my-stardew cabrera-evil/stardew-valley-server -f my-values.yaml

Configuration

Required Parameters

ParameterDescriptionExample
gameServer.steamCredentials.usernameSteam account usernamemysteamuser
gameServer.steamCredentials.passwordSteam account passwordmypassword

Game Server Configuration

ParameterDescriptionDefault
gameServer.steamCredentials.guardCodeSteam Guard 2FA code""
gameServer.vncPasswordVNC access password""
gameServer.disableRenderingDisable graphics rendering"true"
gameServer.gamePortGame server port24642

Image Configuration

ParameterDescriptionDefault
image.repositoryContainer image repositorysdvd/server
image.pullPolicyImage pull policyIfNotPresent
image.tagImage tag"" (uses appVersion)

Service Configuration

ParameterDescriptionDefault
service.typeKubernetes service typeLoadBalancer
service.gamePortService port24642
service.protocolService protocolUDP
service.nodePortNodePort if service type is NodePort"" (auto)
service.externalTrafficPolicyExternal traffic policyLocal
service.annotationsService annotations{}

Persistence Configuration

ParameterDescriptionDefault
persistence.gameData.enabledEnable game data persistencetrue
persistence.gameData.sizeSize of game data PVC10Gi
persistence.gameData.storageClassStorage class"" (default)
persistence.gameData.accessModeAccess modeReadWriteOnce
persistence.gameData.annotationsPVC annotations{}
persistence.serverConfig.enabledEnable config persistencetrue
persistence.serverConfig.sizeSize of config PVC1Gi
persistence.serverConfig.storageClassStorage class"" (default)
persistence.serverConfig.accessModeAccess modeReadWriteOnce
persistence.serverConfig.annotationsPVC annotations{}

Resource Configuration

ParameterDescriptionDefault
resources.requests.memoryMemory request2Gi
resources.requests.cpuCPU request1000m
resources.limits.memoryMemory limit4Gi
resources.limits.cpuCPU limit2000m

Health Probe Configuration

ParameterDescriptionDefault
livenessProbe.enabledEnable liveness probetrue
livenessProbe.initialDelaySecondsInitial delay60
livenessProbe.periodSecondsCheck period30
readinessProbe.enabledEnable readiness probetrue
readinessProbe.initialDelaySecondsInitial delay30
startupProbe.enabledEnable startup probetrue
startupProbe.failureThresholdStartup failures allowed30

Security Configuration

ParameterDescriptionDefault
podSecurityContext.fsGroupPod filesystem group1000
securityContext.runAsUserContainer user ID1000
securityContext.runAsGroupContainer group ID1000
securityContext.runAsNonRootRun as non-roottrue
securityContext.readOnlyRootFilesystemRead-only root filesystemfalse

Common Use Cases

Cloud Deployment (AWS/GCP/Azure)

service:
  type: LoadBalancer
  annotations:
    # AWS
    service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
    # Azure
    service.beta.kubernetes.io/azure-load-balancer-protocol: "UDP"
    # GCP automatically supports UDP

persistence:
  gameData:
    storageClass: "gp3"  # AWS gp3, or fast-ssd for GCP
    size: 20Gi
  serverConfig:
    storageClass: "gp3"

On-Premise/Bare Metal

service:
  type: NodePort
  nodePort: 30642  # Fixed port for firewall rules

persistence:
  gameData:
    storageClass: "local-path"  # or your local storage class
    size: 20Gi

High-Performance Setup

resources:
  requests:
    memory: "4Gi"
    cpu: "2000m"
  limits:
    memory: "8Gi"
    cpu: "4000m"

persistence:
  gameData:
    storageClass: "fast-ssd"
    size: 50Gi

nodeSelector:
  disktype: ssd

Multiple Game Servers

Deploy multiple independent servers:

helm install stardew-farm1 cabrera-evil/stardew-valley-server -f farm1-values.yaml
helm install stardew-farm2 cabrera-evil/stardew-valley-server -f farm2-values.yaml

Each server gets its own PVCs and service endpoint.

Upgrading

Upgrade Chart Version

helm repo update
helm upgrade my-stardew cabrera-evil/stardew-valley-server -f my-values.yaml

Update Game Server Image

helm upgrade my-stardew cabrera-evil/stardew-valley-server \
  --set image.tag=new-version \
  --reuse-values

Backup and Restore

Manual Backup

# Get pod name
POD_NAME=$(kubectl get pod -n default -l app.kubernetes.io/name=stardew-valley-server -o jsonpath='{.items[0].metadata.name}')

# Backup game data
kubectl cp default/$POD_NAME:/data/Stardew ./backup-$(date +%Y%m%d)

# Backup server config
kubectl cp default/$POD_NAME:/config/xdg/config/StardewValley ./backup-config-$(date +%Y%m%d)

Restore from Backup

# Copy backup to pod
kubectl cp ./backup-20240101 default/$POD_NAME:/data/Stardew

# Restart server
kubectl rollout restart deployment/my-stardew

Using Velero for Automated Backups

Tag PVCs for automatic backup:

persistence:
  gameData:
    annotations:
      backup.velero.io/backup-volumes: game-data
  serverConfig:
    annotations:
      backup.velero.io/backup-volumes: server-config

Troubleshooting

Server Won't Start

  1. Check Steam credentials:

    kubectl logs deployment/my-stardew | grep -i steam
    
  2. Verify Steam Guard code (expires after ~30 seconds)

  3. Ensure Steam account owns Stardew Valley

  4. Check pod status:

    kubectl describe pod -l app.kubernetes.io/name=stardew-valley-server
    

Can't Connect to Server

  1. Verify service has external IP:

    kubectl get svc my-stardew
    
  2. Check firewall allows UDP port 24642

  3. Verify client game version matches server

  4. Test connectivity:

    nc -uz <SERVER_IP> 24642
    

Performance Issues

  1. Increase resources:

    resources:
      limits:
        memory: "8Gi"
        cpu: "4000m"
    
  2. Ensure rendering is disabled:

    gameServer:
      disableRendering: "true"
    
  3. Check node resources:

    kubectl top nodes
    kubectl top pods
    

Persistence Issues

  1. Check PVC status:

    kubectl get pvc
    
  2. Verify storage class exists:

    kubectl get storageclass
    
  3. Check PVC events:

    kubectl describe pvc my-stardew-game-data
    

Uninstalling

helm uninstall my-stardew

WARNING: This does NOT delete PVCs by default. To completely remove all data:

# Delete PVCs
kubectl delete pvc -l app.kubernetes.io/instance=my-stardew

# Or delete specific PVCs
kubectl delete pvc my-stardew-game-data my-stardew-server-config

Security Considerations

  • Credentials: Store Steam credentials in Kubernetes secrets or use external secret managers (Sealed Secrets, Vault, External Secrets Operator)
  • Network: Use NetworkPolicy to restrict access if needed
  • Backups: Regularly backup game data to prevent data loss
  • Updates: Keep the server image updated for security patches
  • VNC: Only enable VNC if needed, and use strong passwords

Advanced Configuration

Using External Secrets

With External Secrets Operator:

# Don't set credentials in values
gameServer:
  steamCredentials:
    username: ""  # Will be injected by ExternalSecret
    password: ""

# Create ExternalSecret separately

Custom Init Containers

Add init containers for mod installation or world setup (modify deployment manually or use Helm post-renderer).

StatefulSet Alternative

For more advanced scenarios, consider converting to StatefulSet (requires manual customization).

License

This chart is licensed under the MIT License.

Maintainers

Sources

  • Chart Source: https://github.com/cabrera-evil/charts
  • SDVD Project: https://github.com/Sdv-Dev/sdvd
  • Stardew Valley: https://www.stardewvalley.net/

Contributing

Contributions are welcome! Please open an issue or pull request at the GitHub repository.

Deploy stardew-valley-server with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has stardew-valley-server on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartstardew-valley-server is pinned at v0.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply