4 ms·
> you pay for cloud provided k8s From what I've seen, the cloud provided k8s isn't much more expensive than the vms for the nodes themselves. Amazon's EKS, fo
by cogman10 4y ago
> you pay for cloud provided k8s
From what I've seen, the cloud provided k8s isn't much more expensive than the vms for the nodes themselves. Amazon's EKS, for example, is $0.10 per hour per cluster on top of the ec2 instance price for the nodes you select.
So why wouldn't you do that?
> you don't deviate from the happy paths
Agreed, but if you are deviating from happy paths, it is, IMO, valid to question if k8s is even the right choice. For example, I think k8s is a bad choice if you want to host stateful infrastructure like a DB.
Very large swaths of infrastructure are covered by stateless services.
> you have someone who's going to fix your cluster when you deviate from the happy path
This is pretty much axiomatic of any infrastructure. If someone screws up your vm, you need someone who's going to fix your vm when you deviate from the parameters given for allocating vms.
> Infrastructure is hard.
Agreed
> K8s is a black box wrapping such complexity, but the moment something goes wrong with, let's say, DNS, well, you have to know about DNS to fix the problem (and on top of that you have to know how to fix the problem the k8s way)
When DNS goes wrong anywhere, you have to know how to fix DNS the envoy way, the consul way, the coredns way, the pihole way, the ubuntu way, the freebsd way.
The happy path for k8s is really happy. The sad path is no worse than the sad path of any sort of deployment infrastructure. The default bells and whistles of k8s is something that solves way more problems than is created by needing to learn a new system (For example, liveliness and readiness checks, or cert handling).
But not only that, because k8s is becoming (rightfully) so popular, it means that issues you run into are almost always a google away. There are a ton of resources and patterns that are globally applicable to pretty much any k8s cluster.
- thunky 4y ago> k8s is a bad choice if you want to host stateful infrastructure like a DB You cheated again ;) Now we're only running the easy stateless stuff on k8s? I thought k8s gives us simple abstractions that make running stateful services a breeze.
- cogman10 4y agoWhy is that cheating? I honestly don’t see why focusing on the strengths of a tech and avoiding the weaknesses is considered “cheating”. The whole point of my initial post was “k8s can be as simple or as complex as you want to make it”. It’s not “cheating” to focus on the parts of k8s that make it simple. It’s not “cheating” to use a tech for it’s strengths and not it’s weaknesses. You could technically use (and some people do use) redis as your primary data store. Is it “cheating” to suggest that’s not a good idea? Is it a bad idea to pull it in to your infrastructure even though it’s not a great at permanent storage? K8s biggest value add is stateless applications. I’ve never suggested otherwise. You can get in the weeds of managing volumes and state if you like, but that adds a fair bit of complexity that, IMO, isn’t worth it vs something like a managed db instance from your cloud provider. I honestly don’t get the “you are cheating by using and benefiting from the simplest features and setup of k8s like you said others should do!”
- vbezhenar 4y agoI'm running postgres inside k8s. It's very easy. I don't know why people think that k8s is for stateless.
- Bayart 4y agoI used to think of stateful applications on top of k8s as an anti-pattern until I learned a bit more about some databases uses and changed my entire opinion about what k8s is. If you're coming from the container world, it makes sense to think of orchestration as a way to scale stateless services.
- cogman10 4y agoI'd be glad to hear those usecases. I'm still in the camp of thinking it's not a great idea. I have a hard time thinking coordination between something like postgres and the volume wouldn't be an absolute nightmare to handle. What sorts of volume drivers do you use there? How do you get over the network latency? How does scaling end up working?
- Bayart 4y agoI've not used postgres-on-k8s in any real production workload so my opinion on the matter isn't worth glozing about. I'd rather recommend the blog posts and docs fly.io did on it[1]. They themselves rely on Stolon[2]. AFAIK the secret sauce is postgres' ability for streaming replication[3], ie. pass data across instances as it's ingressed. Add some glue and you've got a cluster. As far as storage goes, k8s supports topology awareness[4] and enables collocating pods and PVs. There are CSI drivers for most file systems you'd encounter in the enterprise[5][6]. > How do you get over the network latency? Ultimately there are incompressible limits you'll hit (CAP theorem and all that). So you do what everybody does in computing : you cheat by exploiting human perception and treating your reads and writes differently[7]. I'm by no means an expert on the subject, but I hope I've answered some of your questions. --- [1]: https://fly.io/blog/globally-distributed-postgres/ https://fly.io/blog/globally-distributed-postgres/ [2]: https://github.com/sorintlab/stolon https://github.com/sorintlab/stolon [3]: https://wiki.postgresql.org/wiki/Streaming_Replication https://wiki.postgresql.org/wiki/Streaming_Replication [4]: https://kubernetes.io/blog/2018/10/11/topology-aware-volume-provisioning-in-kubernetes/ https://kubernetes.io/blog/2018/10/11/topology-aware-volume-... [5]: https://kubernetes.io/blog/2019/01/15/container-storage-interface-ga/ https://kubernetes.io/blog/2019/01/15/container-storage-inte... [6]: https://kubernetes-csi.github.io/docs/drivers.html https://kubernetes-csi.github.io/docs/drivers.html [7]: https://fly.io/blog/globally-distributed-postgres/ https://fly.io/blog/globally-distributed-postgres/