I have a small VPS that hosts some services I use daily and I’d like to migrate that to a K8s cluster. One of the services being hosted is my personal website, built with Hugo and served by Caddy.

Right now, I have the code for my website on Codeberg and I have a CI pipeline that builds the website and uploads it to my VPS via rsync.

I want to move the website to the k8s cluster, but I have no idea how to do it “securely”. What I have right now is a separate user on my VPS called deploy and it rsyncs the files to the data directory Caddy is using to serve my files.

I thought I could do the same on the k8s cluster server, but it’s usually not a good idea to mount host paths with k8s unless absolutely necessary, because container escaping is an actual problem.

So far the only alternative I could think of is to change the CI pipeline to publish my website on another branch and signal it to my K8s cluster so the files should be updated, but I’d like to know what better options exist and how easy they are to setup.

  • @ArbiterXero
    link
    English
    31 year ago

    look up a tutorial on “dockerfile” as you’re essentially making one that installs your app.

    Dockerfiles are basically “install” scripts that define how to set up a new machine with your application.

    You’ll want to start with a base docker image that already has 90% of what you need.

    look up docker hub nginx images and just create a docker file to populate your app to the nginx that’s already been installed there. Use the nginx image as your “source image” in docker.

    It acts like a virtual machine template to launch your own docker image