Not every container out there is built of namespaces and cgroups. But even when it's a traditional Linux container, it's not really a process. What is it then?
...or "How Kubernetes Just Repeats Good Old Deployment Patterns"
1. For a long time, people had been deploying services as groups of virtual (or physical) machines.
But VMs were often slow and bulky. Hence, not very efficient.
2. Then containers gained quite some popularity.
With containers, it became easier to distribute services. Reproducibility also improved. But containers haven't become a replacement for VMs.
Mainly, because of their deliberate focus on being an environment to run a single app:
3. Instead of containers, another abstraction took off - Kubernetes Pods!
A Pod is a group of semi-fused containers. External borders were preserved, but some of the internal isolation b/w containers substituting a Pod got weakened.
Since the async `myHandler` function can be called concurrently from multiple request handlers, the `active` context cannot be not shared. Or so thought I...
But then I learned about the AsyncHooksContextManager module 👇
- Easy to deploy: you can just submit a piece of code
- Easy to monitor: you're generally interested in the absolute invocation duration and the binary outcome (ok/ko).
- Easy to scale 🫰
- And no servers! 🔥
3/ Everything changes when you start using AWS Lambda for full-blown HTTP services:
- Deployment slows down (it'd in any case but it cancels out one of the former pros)
- Observability isn't on par with ECS/EKS
- Scaling up becomes expensive
- What's up with blue/green & canary?
Slim production images is a must - they are fast(er) and secure(r). But there is a problem - they lack debugging tools.
Ephemeral Containers and the `kubectl debug` command help you make the debugging tools available in the cluster on-demand.
The simplest way to start an ephemeral container in an already running Pod:
```
kubectl debug -it --image busybox <POD>
```
The command:
- Updates the Pod spec.
- Starts a new busybox container.
- Attaches your terminal to it.
Without disrupting the Pod!
But there is a problem with the `kubectl debug` default behavior.
You need this command to debug containers in a Pod. However, by default, you won't even see their processes. Nor you'd have access to their filesystems.
Solution 1: Enable shared process namespace on the workload