Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Kubernetes] backup before a container is terminated #246

Merged
merged 4 commits into from
Feb 2, 2024
Merged

[Kubernetes] backup before a container is terminated #246

merged 4 commits into from
Feb 2, 2024

Conversation

win5923
Copy link
Contributor

@win5923 win5923 commented Jan 31, 2024

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

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.
  • I've not introduced breaking changes.

@win5923 win5923 changed the title backup before a container is terminated [Kubernetes] backup before a container is terminated Jan 31, 2024
@anthr76
Copy link
Contributor

anthr76 commented Jan 31, 2024

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

@win5923
Copy link
Contributor Author

win5923 commented Feb 1, 2024

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
Copy link
Contributor Author

win5923 commented Feb 1, 2024

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

@thijsvanloef thijsvanloef added help wanted Extra attention is needed kubernetes Issue/PR related to Kubernetes labels Feb 1, 2024
@anthr76
Copy link
Contributor

anthr76 commented Feb 1, 2024

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?

@win5923
Copy link
Contributor Author

win5923 commented Feb 1, 2024

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.

@thijsvanloef
Copy link
Owner

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

@win5923
Copy link
Contributor Author

win5923 commented Feb 2, 2024

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

Done!

@thijsvanloef thijsvanloef merged commit 24c4071 into thijsvanloef:main Feb 2, 2024
4 checks passed
@bobbyrward
Copy link

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

@win5923
Copy link
Contributor Author

win5923 commented Feb 3, 2024

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 win5923 mentioned this pull request Feb 3, 2024
3 tasks
MusclePr pushed a commit to MusclePr/palworld-server-docker that referenced this pull request Jun 19, 2024
[Kubernetes] backup before a container is terminated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed kubernetes Issue/PR related to Kubernetes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants