cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Starfighter Starfighter
Starfighter
  • 1,198 Views

Container Resource Usage

Hello all,

Will namespaces and cgroups always be involved with the management of resources used by a container?

 

Trevor "Red Hat Evangelist" Chandler
Labels (1)
0 Kudos
2 Replies
flozano
Moderator
Moderator
  • 1,136 Views

Basically you are correct.

Containers at runtime are just a set of namespaces that isolate one process from others. There are many namespaces, such as pid, uid, network, filesystem, and not all of them are required to run a container. You could setup this by yourself, without any container engine, it would just be a lot of work. Without namespaces, there are no containers, not even privileged containers.

CGroups do the "management or resources". It limits the amount of CPU, memory, and other hardware resources a process can use. They are "optional" in the sense that a container could run unbounded, without cgroups restrictions, but then nothing would prevent a container from using up all CPU from a server and starving other containers. When you setup Kubernetes resource limits, you are defining the cgroups settings that kubernetes will pass to the container engine.

Note that namespaces and cgroups are standard Linux kernel features. Nothing that makes a container "run" requires docker, podman, etc. They are just helpers that provide an easier way to set up these for a process. Think about container engines as beefed-up "chroots": run a process under a set of kernel-enforced restrictions, or a kernel-based sandbox.

If you want secure containers, add SELinux. Like podman on RHEL and Feadora and also OpenShift do by default, but other container tools such as docker and other Kubernetes distros don't.

RHEL, Fedora, and OpenShift go further, enaling Kernel capability and seccomp restrctions by default, another thing you might not get from other container runtimes and Kuberntes distros without a lot of customization and configuration.

Trevor
Starfighter Starfighter
Starfighter
  • 1,132 Views

Flozana this is a wonderful explanation.  Marvelous!

Thank you very, very much!

 

Trevor "Red Hat Evangelist" Chandler
0 Kudos
Join the discussion
You must log in to join this conversation.