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.

  • deadbeef79000@lemmy.nz
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 months ago

    Static website? Upload to S3 via CI and serve it from there.

    It’ll cost cents per month.

    K8s is obscene overkill.

    I assume all the cloud vendors have an S3 equivalent.

      • xinayder@infosec.pubOP
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        10 months ago

        I don’t like Cloudflare and I try to steer away from them.

        Using Codeberg/GitHub/GitLab pages was an option as well, but I wanted to have it self-hosted so I have more flexibility and I get to use and customize Caddy to my liking.

  • xinayder@infosec.pubOP
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 months ago

    Thanks for the suggestions!

    I ended up configuring my CI pipeline to build a Caddy docker image that ships with my website files. The pipeline is also publishing the container image to the Codeberg registry and I apply the new image repo and tag to the Caddy Helm chart I found on ArtifactHub.

    The only thing that’s left is to setup the CI to automatically restart the pod when a new image is pushed, so it will always have the latest version.

    It was easier than expected and I had a few issues like my stylesheets not being applied and image files not rendering, but it was solved by changing the pathType field on the ingress configuration to Prefix.

  • Decronym@lemmy.decronym.xyzB
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    10 months ago

    Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

    Fewer Letters More Letters
    Git Popular version control system, primarily for code
    HTTP Hypertext Transfer Protocol, the Web
    VPS Virtual Private Server (opposed to shared hosting)
    k8s Kubernetes container management package
    nginx Popular HTTP server

    4 acronyms in this thread; the most compressed thread commented on today has 6 acronyms.

    [Thread #149 for this sub, first seen 19th Sep 2023, 12:35] [FAQ] [Full list] [Contact] [Source code]

  • beeng@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    CI pipeline build your site and docker image, deliver to a registry.

    CD deploy and always pull your docker image from container registry.