4 ms·
The article is pretty lite, though I agree with most of the points. However, I think that, especially in the context context of Kubernetes, this part is comple
by tsimionescu 4y ago
The article is pretty lite, though I agree with most of the points.
However, I think that, especially in the context context of Kubernetes, this part is completely wrong:
> Containers were a great advance, but much of their complexity falls into the “accidental” category. There’s no fundamental reason that I should need anything except my compiler to produce a universally deployable unit of code.
Containers are not used in Kubernetes or other similar orchestrators because of their support for bundling dependencies - that is a bonus at best.
Instead, they are used because they are a standard way of using cgroups to tightly control what pieces of the system a process has access to, so that multiple processes running on the same system can't accidentally affect each other, and so that a process can't accidentally depend on the system it is running on (including things like open ports). These are key properties for a system that seeks to efficiently distribute workloads on a number of computers without having to understand the specifics of what workload it's running.
They are also used because container registries are a ready made secure Linux distribution-agnostic way of retrieving software and referring to it with a unique name. quay.io/python:3.7 will work on Ubuntu, SuSE, RedHat or any other base system, unlike relying on apt/yum/etc.
- zamalek 4y agoI think they mean different things to different people. From the problems I have faced with customer-controlled OS installations, the biggest thing that they offer is configuration isolation (or rather independence). I have seen some truly crazy shit done by customer's administrators and even crazier shit done by management software that they install. Taking away that autonomy is huge.
- tsimionescu 4y agoAbsolutely, but the context of the article was specifically Kubernetes.
- paulgb 4y agoIn the context of Kubernetes, what do containers have to do with cgroups? I get that container runtimes typically provide a nicer interface for setting them up, but Kubernetes doesn’t use those interfaces anyway. If it was just about cgroups, they could have just run a regular process in cgroups.
- samus 4y agoContainers are a construct created by employing cgroups + namespaces together. Namespaces provide isolations in terms of filesystem, network, users, processes, and probably more.
- paulgb 4y agoYes, but those are features of Linux that containers use; containers don’t have exclusive use of them. My original point was: > Containers were a great advance, but much of their complexity falls into the “accidental” category. There’s no fundamental reason that I should need anything except my compiler to produce a universally deployable unit of code. I stand by that. We might just be arguing semantics about whether that unit of code would be called a “container” or not. I’m leaving open the possibility that it would be (say) a WebAssembly module or static binary.
- samus 4y agoA container can also give your application assurance that the file system looks a certain way. But you are right that you can get pretty far with bundling dependencies and assets and configuring all nontrivial paths with environment variables. However, the choice of containers for Kubernetes is a pretty fundamental one. It simplifies distribution of deployables to a single workflow also for programming languages that don't offer monolithic deployables, to legacy application not originally intended for Kubernetes, or that don't follow the 12 factor app principles.
- jfoutz 4y agoAfter thinking about this for a few minutes, the author might be on the wrong track connecting this with containers. But I think there's something really there about "environmental linting". I know deep in my bones I need write access to make log files, but I don't know how many times I've debugged systems lacking this permission. I know the log path won't be known until runtime, I know the port can be specified at runtime, but I think there's a ton of room for improvement around a tool that says - hey, you're making this set of assumptions about your environment, and you should have these health checks or tests or whatever. I agree with you about this is what containers give, but I think the author is really on to something about the dev tooling and environment warning about what sorts of permissions are needed to, like, work.
- paulgb 4y ago> Containers are not used in Kubernetes or other similar orchestrators because of their support for bundling dependencies - that is a bonus at best. > Instead, they are used because they are a standard way of using cgroups to tightly control what pieces of the system a process has access to Well, sure, you get both. But the point is that needing a post-build step just to get that is accidental complexity. I'm by no means a Java fan, but the way JVM gives jars as a compile target and lets you run them with some measure of isolation is an example of how things could be.
- threeseed 4y agoWith Maven, Gradle etc you can output a Docker container from a single package command. And I don't understand this idea of using code bundles as the deployment artefact. They don't specify how the code should be run e.g. Java version, set of SSL certificates in your keystore etc. Do you really want Kubernetes to have hundreds of options for each language ? Or is it better to just leave that up to the user.
- anonymous_sorry 4y agoI think the suggestion is to use native Linux binaries with static linking of any libraries and resources in the executable. Java programs would need to be compiled as a standard ELF. I think GraalVM can do this.
- threeseed 4y agoOnly some Java/Scala programs can be compiled as a single binary. It's been a concept that has been around for years but not progressing to the point where it comes close to negating the need for the JVM in a Production environment. In the meantime containers works today and is significantly more powerful and flexible.
- krageon 4y agoThe fallback scenario just embeds the interpreter inside of the binary. That still nets you a single binary, unless I'm missing something?
- candiddevmike 4y agoContainers are a temporary solution while we wait for everyone to realize self contained binaries with static linking are the real solution.
- threeseed 4y agoThat is only a real solution if everything is running on the same operating system in the same environment. What is the point of Kubernetes at all in your situation.
- candiddevmike 4y agoEverything already is running on the same operating system with Kubernetes where it matters (kernel, runc/crun, etc). Containers are a band aid to wrap an app with additional files/libraries/whatever. In Go for instance, I can include all this stuff at compile time (even conditionally!). I'd love to see Kubernetes be able to schedule executables directly without using containers by way of systemd nspawn or similar. You could have the "container feel" without the complexity of the tool chain required to build/deploy/run/validate containers.
- samus 4y agoThe tool chain to build/deploy/run/validate is the whole point to containers. It's something that unifies the deployment model of applications, unless you want to commit to a single programming language ecosystem. And not every ecosystem has tools to create a monolithic deployment artifact. Even if you have monolithic deployment artifacts: by the time you have solved all the use cases that the image distribution workflow cover, you have basically reverse-engineered it. If you have already done that, kudos to you, you indeed don't need that workflow. And you probably will find it very easy to containerise those artifacts should you ever need to.
- theteapot 4y agoSounds pretty much like containers are the solution to containers.
- kube-system 4y agoWhy not both? “Works on my computer” was absolutely a problem that docker advertised itself as a solution for.
- zozbot234 4y agoYou're right that 'containers' are essentially a higher-level pattern but the main underlying building block is arguably kernel namespaces, not just cgroups.