Kubernetes Flashcards
Virtual machines pros
Efficiency.
Flexibility.
Backup and recovery.
OS freedom.
Performance and moving.
Virtual machines cons
Performance overhead.
Efficient resource utilization.
Why not use simple processes instead of vms?
Isolation.
Manage application dependencies.
Containers
Containers provide OS-level.
Provides private namespace, network interface and IP adress , file systems, ect.
Unlike VMs, containers share
the host system’s kernel with
other containers
Containers promises
Build once, run anywhere
* Faster deployment
* Portability across machines
* Version control
* Simplified dependency management
chroot
Allows to specify a directory as the root directory for
an application. This makes it impossible for an application to
access other application files (and other resources, depending
on the systems).
Chroot isolation not perfect. The process can still access the
underlying IO devices, it can execute a second chroot if it has
enough privileges.
All application dependencies need to be copied into the chroot
directory.
Docker
Docker is the most popular container technology.
It builds on the following technologies:
* Kernel namespaces
* Cgroups
* Copy-on-write File system
Kernel namespaces
Kernel namespaces split kernel resources (processes, users,
network stacks, etc.) into one instance per namespace.
A process only views the resources in its namespace.
How many namespaces
There are currently 6 namespaces:
* mnt (mount points, filesystems)
* pid (processes)
* net (network stack)
* ipc (System V IPC)
* uts (hostname)
* user (UIDs)
Implementation of kernel namespaces
New system calls:
* clone() - creates a new process and a new namespace;
* The process is associated to the new namespace.
* unshare() - creates a new namespace and attaches the
current process to it.
* setns() - allows for joining an existing namespace.
Uses for kernel namespaces
Kernel namespaces are used to create isolated containers that
have no visibility to objects outside the container.
The processes running inside a container share the underlying
kernel with other containers.
Cgroups
Cgroups are a mechanism for applying hardware resource
limits and access controls to a process or collection of
processes.
The cgroup mechanism and the related subsystems provide a
tree-based hierarchical, inheritable and optionally nested
mechanism of resource control.