palworld-server-docker icon indicating copy to clipboard operation
palworld-server-docker copied to clipboard

[Kubernetes] backup before a container is terminated

Open win5923 opened this issue 1 year ago • 5 comments

Incorporate backup functionality before the termination of a container due to API requests or management events such as liveness/startup probe failure, preemption, resource contention, and others.

Choices

  • Add backup before a container is terminated.
  • Addressing https://github.com/thijsvanloef/palworld-server-docker/issues/243#issue-2110148331
  • Refer to https://github.com/thijsvanloef/palworld-server-docker/pull/206#issue-2105868641

Test instructions

  1. I haven't tested it yet. I'll conduct the test in a few days.

Checklist before requesting a review

  • [ ] I have performed a self-review of my code
  • [ ] I've added documentation about this change to the README.
  • [x] I've not introduced breaking changes.

win5923 avatar Jan 31 '24 20:01 win5923

Considering this would need RBAC (and kubectl in the container) it would be probably be better to just execute a script in the container

anthr76 avatar Jan 31 '24 20:01 anthr76

Considering this would need RBAC (and kubectl in the container) it would be probably be better to just execute a script in the container

I just realized that I am running inside a pod, so there is no need to execute kubectl. Thank you for your advice. But I haven't come up with a better method to determine the pod is unhealthy.

win5923 avatar Feb 01 '24 01:02 win5923

Perhaps a livenessProbe for the RCON port can be configured, but I'm not sure about the correlation between the server and RCON.

   livenessProbe: 
      tcpSocket:
        port: 25575
      initialDelaySeconds: 30
      periodSeconds: 60

win5923 avatar Feb 01 '24 05:02 win5923

Good point 👍🏼 I think we just address the probe(s) in another PR as that may be tricky. I'll try to think about a solution. This looks good! Should we also add a /Shutdown to the rcon commands?

anthr76 avatar Feb 01 '24 13:02 anthr76

After a liveness probe failure, the pod will be restarted. I think it may not be necessary. I might conduct a test using Minikube in the next few days.

win5923 avatar Feb 01 '24 14:02 win5923

@win5923 Just give me a headsup when it is ready to merge :)

thijsvanloef avatar Feb 02 '24 12:02 thijsvanloef

@win5923 Just give me a headsup when it is ready to merge :)

Done!

win5923 avatar Feb 02 '24 14:02 win5923

This doesn't work. exec only takes a command not a command and args

bobbyrward avatar Feb 02 '24 23:02 bobbyrward

This doesn't work. exec only takes a command not a command and args

Oh, you're right. I forgot to save before applying. No wonder I was able to apply successfully. I will resubmit a new pull request to correct this error. Thank you very much.

win5923 avatar Feb 03 '24 08:02 win5923