| ▲ | kachapopopow a day ago |
| since this is on the front page (again?) I guess I'll chime in: learn kubernetes - it's worth it. It did take me 3 attempts at it to finally wrap my head around it I really suggest trying out many different things and see what works for you. And I really recommend starting with *default* k3s, do not look at any alternatives to cni, csi, networked storage - treat your first cluster as something that can spontaniously fail and don't bother keeping it clean learn as much as you can. Once you have that, you can use great open-source k8s native controllers which take care of vast majority of requirements when it comes to self-hosting and save more time in the long run than it took to set up and learn these things. Honerable mentions: k9s, lens(I do not suggest using it in the long-term, but UI is really good as a starting point), rancher webui. PostgreSQL specifically: https://github.com/cloudnative-pg/cloudnative-pg
If you really want networked storage: https://github.com/longhorn/longhorn I do not recommend ceph unless you are okay with not using shared filesystems as they have a bunch of gotchas or if you want S3 without having to install a dedicated deployment for it. |
|
| ▲ | ninkendo a day ago | parent | next [-] |
| At $WORK we’ve been using the Zalando Postgres kubernetes operator to great success: https://github.com/zalando/postgres-operator As someone who has operated Postgres clusters for over a decade before k8s was even a thing, I fully recommend just using a Postgres operator like this one and moving on. The out of box config is sane, it’s easy to override things, and failover/etc has been working flawlessly for years. It’s just the right line between total DIY and the simplicity of having a hosted solution. Postgres is solved, next problem. |
| |
| ▲ | vovavili a day ago | parent [-] | | For something like a database, what is the added advantage to using Kubernetes as opposed to something simple like Docker Compose? | | |
| ▲ | alex23478 a day ago | parent | next [-] | | In this case the advantage are operators for running postgres. With Docker Compose, the abstraction level you're dealing with is containers, which means in this case you're saying "run the postgres image and mount the given config and the given data directory". When running the service, you need to know how to operate the software within the container. Kubernetes at its heart is an extensible API Server, which allows so called "operators" to create custom resources and react to them. In the given case, this means that a postgres operator defines for example a PostgresDatabaseCluster resource, and then contains control loops to turn these resources into actual running containers.
That way, you don't necessarily need to know how postgres is configured and that it requires a data directory mount. Instead, you create a resource that says "give me a postgres 15 database with two instances for HA fail-over", and the operator then goes to work and manages the underlying containers and volumes. Essentially operators in kubernetes allow you to manage these services at a much higher level. | |
| ▲ | mystifyingpoi a day ago | parent | prev | next [-] | | Docker Compose (ignoring Swarm which seems to be obsolete) manages containers on a single machine. With Kubernetes, the pod that hosts the database is a pod like any other (I assume). It gets moved to a healthy machine when node goes bad, respects CPU/mem limits, works with generic monitoring tools, can be deployed from GitOps tools etc. All the k8s goodies apply. | | |
| ▲ | Nextgrid a day ago | parent [-] | | When it comes to a DB moving the process around is easy, it's the data that matters. The reason bare-metal-hosted DBs are so fast is that they use direct-attach storage instead of networked storage. You lose those speed advantages if you move to distributed storage (Ceph/etc). | | |
| ▲ | ninkendo a day ago | parent [-] | | You don’t need to use networked storage, the zalando postgres operator just uses local storage on the host. It uses a StatefulSet underneath so that pods will stay on the same node until you migrate them. | | |
| ▲ | Nextgrid a day ago | parent [-] | | But if I'm pinning it to dedicated machines then Kubernetes does not give me anything, but I still have to deal with its tradeoffs and moving parts - which from experience are more likely to bring me down than actual hardware failure. | | |
| ▲ | ninkendo 12 hours ago | parent | next [-] | | It’s not like anyone’s recommending you setup k8s just to use Postgres. The advice is that, if you’re already using k8s, the Postgres operator is pretty great, and you should try it instead of using a hosted Postgres offering or having a separate set of dedicated (non-k8s) servers just for Postgres. I will say that even though the StatefulSet pins the pod to a node, it still has advantages. The StatefulSet can be scaled to N nodes, and if one goes down, failover is automatic. Then you have a choice as an admin to either recover the node, or just delete the pod and let the operator recreate it on some other node. When it gets recreated, it resyncs from the new primary and becomes a replica and you’re back to full health, it’s all pretty easy IMO. | |
| ▲ | lukaslalinsky 17 hours ago | parent | prev [-] | | I run PostgreSQL+Patroni on Kubernetes where each instance is a separate StatefulSet pinned to dedicated hosts, with data on local ZFS volumes, provisioned by the OpenEBS controller. I do this for multiple reasons, one is that I find it easier to use Kubernetes as the backend for Patroni, rather than running/securing/maintaining just another etcd cluster. But I also do it for observability, it's much nicer to be able to pull all the metrics and logs from all the components. Sure, it's possible to set that up without Kubernetes, but why if I can have the logs delivered just one way. Plus, I prefer how self-documenting the whole thing is. No one likes YAML manifests, but they are essentially running documentation that can't get out of sync. |
|
|
|
| |
| ▲ | ninkendo a day ago | parent | prev | next [-] | | The assumption is that you’re already using Kubernetes, sorry. Docker compose has always been great for running some containers on a local machine, but I’ve never found it to be great for deployments with lots of physical nodes. k8s is certainly complex, but the complexity really pays off for larger deployments IMO. | |
| ▲ | kachapopopow a day ago | parent | prev [-] | | I hate that this is starting to sound like a bot Q&A, but the primary advantages is that it provides secure remote configuration and it's that it's platform agnostic, multi-node orchestration, built in load balancing and services framework, way more networking control than docker, better security, self healing and the list goes on, you have to read more about it to really understand the advantages over docker. |
|
|
|
| ▲ | satvikpendem a day ago | parent | prev | next [-] |
| Check out canine.sh, it's to Kubernetes what Coolify or Dokploy is to Docker, if you're familiar with self hosted open source PaaS. |
| |
| ▲ | chuckadams a day ago | parent | next [-] | | And on a similar naming note yet totally unrelated, check out k9s, which is a TUI for Kubernetes cluster admin. All kinds of nifty features built-in, and highly customizable. | | |
| ▲ | satvikpendem a day ago | parent [-] | | If we're talking about CLIs, check out Kamal, the build system that 37signals / Basecamp / DHH developed, specifically to move off the cloud. I think it uses Kubernetes but not positive, it might just be Docker. | | |
| ▲ | Nextgrid a day ago | parent [-] | | It's just Docker - it SSH's in to the target servers and runs `docker` commands as needed. |
|
| |
| ▲ | kachapopopow a day ago | parent | prev [-] | | I just push to git where there is a git action to automatically synchronize deployments |
|
|
| ▲ | chandureddyvari a day ago | parent | prev | next [-] |
| Any good recommendations you got for learning kubernetes for busy people? |
| |
| ▲ | mystifyingpoi a day ago | parent | next [-] | | No path for busy people, unfortunately. Learn everything from ground up, from containers to Compose to k3s, maybe to kubeadm or hosted. Huge abstraction layers coming from Kubernetes serve their purpose well, but can screw you up when anything goes slightly wrong on the upper layer. For start, ignore operators, ignore custom CSI/CNI, ignore IAM/RBAC. Once you feel good in the basics, you can expand. | |
| ▲ | kachapopopow a day ago | parent | prev [-] | | k3sup a cluster, ask an AI on how to serve an nginx static site using trafeik on it and explain every step of it and what it does (it should provide: a config map, a deployment, a service and an ingress) k3s provides: csi, cni (cluster storage interface, cluster network interface) which is flannel and and local-pv which just maps volumes to disk (pvcs) trafeik is what routes your traffic from the outside to inside your cluster (to an ingress resource) |
|
|
| ▲ | groundzeros2015 a day ago | parent | prev [-] |
| Are you working on websites with millions of hourly visits? |