Sobes.tech
Junior — Middle

How do privilege levels differ in Docker and Kubernetes and what is their main difference?

sobes.tech AI

Answer from AI

In Docker and Kubernetes, privilege levels are related to security and access control, but they are implemented differently due to architectural differences.

Docker:

  • Containers run on a single host and use the host OS kernel.
  • Container privileges depend on the user inside the container and security settings (for example, the --privileged flag grants the container extended rights).
  • Containers can run with limited rights, but misconfiguration can allow access to the host.

Kubernetes:

  • Manages multiple containers and nodes.
  • Uses RBAC (Role-Based Access Control) to differentiate user and service permissions within the cluster.
  • Controls rights at the API server level, allowing fine-grained access to cluster resources.
  • Also supports SecurityContext for configuring container rights (for example, running as a non-privileged user).

Main difference: Docker manages privileges at the level of individual containers and the host, while Kubernetes manages privileges at the cluster level with centralized access control and security policies.

Example: In Kubernetes, you can set a role that only allows reading pods, whereas such a level of restriction is absent in Docker.