• 1 Post
  • 4 Comments
Joined 1 year ago
cake
Cake day: June 13th, 2023

help-circle




  • fhqwgads@possumpat.iotoSelfhosted@lemmy.worldVMs or containers?
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    1 year ago

    Basically, it’s “why not both?”

    So first, kubernetes is a different ball of wax than containers, and if you want to run it on one machine you can, but it’s really for running containers across a cluster of machines. I’m guessing you just generally mean containers so I’ll go with that.

    Containers are essentially just apps running on a virtual os. Virtual machines are an OS running on virtual hardware. You can abstract both layers and have virtual hardware running an os that runs a virtual os for your containers, and nothing will really mind - in fact that’s kind of the way to do it if you have one big machine you need to run a bunch of services on. You might cut up a server into a Linux VM, a Windows VM, and a BSD VM, and run containers on each one. Or you might run 3 Linux VMs and have the containers for 3 different services split between them.

    It really depends on what you’re hosting and trying to do for how exactly to go about it. Take for instance a pretty common self hosted stack:

    Plex Radarr Prowlarr Deluge TrueNAS

    Now you could install TrueNAS scale and run all of those as containers on it, and it would work ok, but TrueNAS scale isn’t really meant for managing a ton of containers right now. You could make a vm on it for each service and have them all talk to each other but then you’re probably wasting resources by duplicating the OS 5 times. Also, what if you want to run TrueNAS core instead of scale? Can you get everything else working in jails – maybe? – but it’ll probably be a pain.

    Instead, you might install proxmox and pass through the drive controller, and set up one VM for TrueNAS core. Then you might make another VM for the arrs containers, and a third for Plex itself.

    It gets you the best of both worlds. TrueNAS can run on BSD instead of Linux, your arrs are easy to deploy and update in containers that keep everything separated, and Plex is sequestered in a hardened os with read only access to everything else since it gets a port forwarded and is more of a security risk. Again that’s just one option though.

    VMs get you a ton of really handy things like snapshots and for simple VMs, very easy portability between relatively similar hardware. I’ll probably get ruined for saying this but they’re also a security tool that you should probably keep in your belt. If someone manages to break out of a container and your files are just sitting there for the taking that’s not great. If someone manages to break into your VM and “the good stuff” is on another VM that’s another layer of security they have to break through.

    Containers on the other hand use way fewer resources, especially ram - and are much easier to wrangle than many OSes for updates and config.

    There’s really a lot of self hosted stuff that assumes you’re running docker and treats regular install as a kind of weird edge case, so you’ll probably run docker even if you don’t want to.

    Kubernetes on the other hand I would argue isn’t really meant for self hosting where you probably have a one or two servers that you own. Its meant to deploy containers across various cloud servers in a way that’s more automated to manage. If you need storage in a kubernetes cluster you’ll probably use something like s3 buckets, not a hard drive.

    If you want to learn it you can totally deploy it on a computer running a few VMs as nodes or with a few laptops / SBCs as a cluster, but if you just want the services to run on your server in the closet it’s a bit like using a sledgehammer to nail a chair back together. That’s why you don’t tend to see it talked about as much - it’s a bit of a different rabbit hole.