thijsvanloef / palworld-server-docker

A Docker Container to easily run a Palworld dedicated server.
https://hub.docker.com/r/thijsvanloef/palworld-server-docker
MIT License
2.43k stars 295 forks source link

Permission issues running on Kubernetes #63

Closed Slyke closed 9 months ago

Slyke commented 9 months ago

Describe the bug

Server fails to install on first run due to not being able to write to filesystem.

To Reproduce

Deploy as a Kubernetes pod.

Expected behavior

Server should start up

Container/Host Logs

*****EXECUTING USERMOD*****
usermod: no changes
*****STARTING INSTALL/UPDATE*****
tid(22) burning pthread_key_t == 0 so we never use it
Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
Logging directory: '/home/steam/Steam/logs'
[  0%] Checking for available updates...
[----] Verifying installation...
[  0%] Downloading update...
[  0%] Checking for available updates...
[----] Download complete.
[----] Extracting package...
[----] Extracting package...
[----] Extracting package...
[----] Extracting package...
[----] Installing update...
[----] Installing update...
[----] Installing update...
[----] Installing update...
[----] Installing update...
[----] Installing update...
[----] Installing update...
[----] Installing update...
[----] Cleaning up...
[----] Update complete, launching Steamcmd...
tid(34) burning pthread_key_t == 0 so we never use it
Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
Logging directory: '/home/steam/Steam/logs'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1705108307
-- type 'quit' to exit --
Loading Steam API...OK

Connecting anonymously to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x61) downloading, progress: 0.00 (0 / 4729437191)
 Update state (0x61) downloading, progress: 2.29 (108384492 / 4729437191)
 Update state (0x61) downloading, progress: 5.08 (240183440 / 4729437191)
 Update state (0x61) downloading, progress: 7.53 (356275404 / 4729437191)
 Update state (0x61) downloading, progress: 10.33 (488396193 / 4729437191)
 Update state (0x61) downloading, progress: 13.65 (645404772 / 4729437191)
 Update state (0x61) downloading, progress: 16.69 (789113983 / 4729437191)
 Update state (0x61) downloading, progress: 19.91 (941427815 / 4729437191)
 Update state (0x61) downloading, progress: 23.01 (1088228455 / 4729437191)
 Update state (0x61) downloading, progress: 25.20 (1192037479 / 4729437191)
 Update state (0x61) downloading, progress: 28.26 (1336745774 / 4729437191)
 Update state (0x61) downloading, progress: 31.01 (1466769198 / 4729437191)
 Update state (0x61) downloading, progress: 33.36 (1577918254 / 4729437191)
 Update state (0x61) downloading, progress: 35.65 (1685921582 / 4729437191)
 Update state (0x61) downloading, progress: 37.91 (1792890379 / 4729437191)
 Update state (0x61) downloading, progress: 42.31 (2001059761 / 4729437191)
 Update state (0x61) downloading, progress: 45.43 (2148528266 / 4729437191)
 Update state (0x61) downloading, progress: 49.56 (2343701569 / 4729437191)
 Update state (0x61) downloading, progress: 53.25 (2518296590 / 4729437191)
 Update state (0x61) downloading, progress: 54.59 (2581742088 / 4729437191)
 Update state (0x61) downloading, progress: 56.48 (2671303466 / 4729437191)
 Update state (0x61) downloading, progress: 58.29 (2756745623 / 4729437191)
 Update state (0x61) downloading, progress: 59.18 (2798660769 / 4729437191)
 Update state (0x61) downloading, progress: 60.01 (2838316974 / 4729437191)
 Update state (0x61) downloading, progress: 60.83 (2876766893 / 4729437191)
 Update state (0x61) downloading, progress: 61.67 (2916641276 / 4729437191)
 Update state (0x61) downloading, progress: 62.51 (2956178020 / 4729437191)
 Update state (0x61) downloading, progress: 63.32 (2994558115 / 4729437191)
 Update state (0x61) downloading, progress: 64.14 (3033355343 / 4729437191)
 Update state (0x61) downloading, progress: 64.96 (3072152523 / 4729437191)
 Update state (0x61) downloading, progress: 65.78 (3110949827 / 4729437191)
 Update state (0x61) downloading, progress: 66.73 (3155752426 / 4729437191)
 Update state (0x61) downloading, progress: 67.60 (3197093791 / 4729437191)
 Update state (0x61) downloading, progress: 68.54 (3241786714 / 4729437191)
 Update state (0x61) downloading, progress: 71.54 (3383365205 / 4729437191)
 Update state (0x61) downloading, progress: 72.70 (3438325885 / 4729437191)
 Update state (0x61) downloading, progress: 73.57 (3479237786 / 4729437191)
 Update state (0x61) downloading, progress: 74.42 (3519568991 / 4729437191)
 Update state (0x61) downloading, progress: 75.20 (3556387982 / 4729437191)
 Update state (0x61) downloading, progress: 76.03 (3596019915 / 4729437191)
 Update state (0x61) downloading, progress: 76.87 (3635544908 / 4729437191)
 Update state (0x61) downloading, progress: 77.70 (3674593429 / 4729437191)
 Update state (0x61) downloading, progress: 78.55 (3714843306 / 4729437191)
 Update state (0x61) downloading, progress: 79.41 (3755557556 / 4729437191)
 Update state (0x61) downloading, progress: 80.26 (3795973631 / 4729437191)
 Update state (0x61) downloading, progress: 81.06 (3833827171 / 4729437191)
 Update state (0x61) downloading, progress: 82.77 (3914522763 / 4729437191)
 Update state (0x61) downloading, progress: 84.77 (4009050568 / 4729437191)
 Update state (0x61) downloading, progress: 85.67 (4051763547 / 4729437191)
 Update state (0x61) downloading, progress: 86.87 (4108626675 / 4729437191)
 Update state (0x61) downloading, progress: 88.38 (4179800951 / 4729437191)
 Update state (0x61) downloading, progress: 89.70 (4242228934 / 4729437191)
 Update state (0x61) downloading, progress: 90.49 (4279676948 / 4729437191)
 Update state (0x61) downloading, progress: 91.37 (4321390114 / 4729437191)
 Update state (0x61) downloading, progress: 92.29 (4365025289 / 4729437191)
 Update state (0x61) downloading, progress: 93.08 (4402274263 / 4729437191)
 Update state (0x61) downloading, progress: 94.69 (4478527717 / 4729437191)
 Update state (0x61) downloading, progress: 95.85 (4533057867 / 4729437191)
 Update state (0x61) downloading, progress: 96.67 (4571856172 / 4729437191)
 Update state (0x61) downloading, progress: 97.56 (4613836491 / 4729437191)
 Update state (0x61) downloading, progress: 98.50 (4658458797 / 4729437191)
 Update state (0x61) downloading, progress: 99.30 (4696480581 / 4729437191)
 Update state (0x81) verifying update, progress: 4.97 (234924295 / 4729437191)
 Update state (0x81) verifying update, progress: 16.21 (766559038 / 4729437191)
 Update state (0x81) verifying update, progress: 26.92 (1273021246 / 4729437191)
 Update state (0x81) verifying update, progress: 33.01 (1561113806 / 4729437191)
 Update state (0x81) verifying update, progress: 40.64 (1922095267 / 4729437191)
 Update state (0x81) verifying update, progress: 51.30 (2426012147 / 4729437191)
 Update state (0x81) verifying update, progress: 64.44 (3047759124 / 4729437191)
 Update state (0x81) verifying update, progress: 77.44 (3662563600 / 4729437191)
 Update state (0x81) verifying update, progress: 90.23 (4267261630 / 4729437191)
Success! App '2394010' fully installed.
*****CHECKING FOR EXISTING CONFIG*****
*****GENERATING CONFIG*****
timeout: failed to run command './PalServer.sh': Permission denied
cp: cannot stat '/palworld/DefaultPalWorldSettings.ini': No such file or directory
RCON_ENABLED=true
sed: can't read /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini: No such file or directory
RCON_PORT=25575
sed: can't read /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini: No such file or directory
*****STARTING SERVER*****
./PalServer.sh -port=8211 -players=16 -servername=****** -serverpassword=****** -adminpassword=*******
sh: 1: ./PalServer.sh: Permission denied

Additional context

My deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: palworld
  name: palworld
  namespace: game-servers
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: palworld
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: palworld
    spec:
      containers:
      - env:
        - name: ServerIP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        envFrom:
        - configMapRef:
            name: palworld-config-cm
        image: thijsvanloef/palworld-server-docker:v0.10
        imagePullPolicy: IfNotPresent
        name: palworld
        ports:
        - containerPort: 25575
          name: palworld-rcon
          protocol: TCP
        - containerPort: 8211
          name: palworld-game
          protocol: UDP
        - containerPort: 27015
          name: palworld-query
          protocol: UDP
        volumeMounts:
        - mountPath: /palworld/
          name: palworld-data
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
      - name: palworld-data
        persistentVolumeClaim:
          claimName: palworld-pvc

Workaround is to add a initContainer:

      initContainers:
      - name: permissions-update
        image: busybox:1.35.0
        imagePullPolicy: IfNotPresent
        command: ["/bin/sh", "-c", "chown -R 1000:1000 /palworld; chmod -R 770 /palworld"]
        volumeMounts:
          - mountPath: /palworld
            name: palworld-data
      - name: permissions-check
        image: busybox:1.35.0
        imagePullPolicy: IfNotPresent
        command: ["/bin/sh", "-c", "ls -ahl /palworld"]
        volumeMounts:
          - mountPath: /palworld
            name: palworld-data

Add any other context about the problem here.

thijsvanloef commented 9 months ago

k8s support has just been merged https://github.com/thijsvanloef/palworld-server-docker/pull/65, closing the issue.