Top Banner
An Introduction to Kubernetes Imesh Gunaratne Product Lead, WSO2 Private PaaS Committer & PMC Member, Apache Stratos
27
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An Introduction to Kubernetes

An Introduction to Kubernetes

Imesh Gunaratne

Product Lead, WSO2 Private PaaSCommitter & PMC Member, Apache Stratos

Page 2: An Introduction to Kubernetes

Agenda

● Linux Containers● Docker● Kubernetes● Kubernetes Architecture● Kubernetes Demo

Page 3: An Introduction to Kubernetes

Linux Containers

Page 4: An Introduction to Kubernetes

Linux Containers

Linux Container Brief for IEEE WG P2302, Boden Russell

Page 5: An Introduction to Kubernetes

Linux Containers

An operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host.

http://en.wikipedia.org/wiki/LXC

Page 6: An Introduction to Kubernetes

Linux Kernel Features used by Linux Containers

● Namespaces (mnt, pid, net, ipc, uts/hostname, user ids)● cgroups (cpu, memory, disk, i/o - resource management) ● AppArmor, SELinux

(security/access control)● seccomp

(computation isolation)● chroot (file system isolation)

http://www.slideshare.net/imesh/evoluation-of-linux-container-virtualization

Page 7: An Introduction to Kubernetes

LXC Engine: A Hypervisor for Containers

Linux Container Brief for IEEE WG P2302, Boden Russell

Page 8: An Introduction to Kubernetes

More about Linux Containers

https://linuxcontainers.org

Page 9: An Introduction to Kubernetes
Page 10: An Introduction to Kubernetes

Docker

● A platform for managing Linux Containers● Began as an open-source implementation of

the deployment engine which powers dotCloud

● Started in March, 2013● Provided an easy to use API and powerful

container image management features● Attracted the community very fast

https://github.com/docker/docker/blob/master/README.md

Page 11: An Introduction to Kubernetes

Docker is built on

● cgroup and namespacing capabilities of the Linux kernel

● Go programming language(written in Go)

● Docker Image Specification (for container image management)● Libcontainer Specification (namespaces, filesystem, resources, security, etc)

https://github.com/docker/docker/blob/master/README.md

Page 12: An Introduction to Kubernetes

Virtual Machines Vs Docker

https://www.docker.com/whatisdocker/

Page 13: An Introduction to Kubernetes

Docker Architecture

Enterprise Docker, Adrien BLIND, Aurelien GABET, Arnaud MAZIN

Page 14: An Introduction to Kubernetes

Docker Image Structure

https://docs.docker.com/terms/image/

Page 15: An Introduction to Kubernetes

Docker - Hello World# Get one base Docker image>docker pull ubuntu

# List Docker images available>docker images

# Run hello world>docker run ubuntu:14.04 echo "hello world"

Docker Paris Meetup, Victor Vieux, dotCloud Inc

Page 16: An Introduction to Kubernetes

Detached mode# Run hello world in detached mode (-d)>docker run -d ubuntu sh -c "while true; do echo hello world; sleep 1; done"

# Get container’s ID>docker ps

# Attach to the container>docker attach <container-id>

# Stop/start/restart the container>docker stop <container-id>

Docker Paris Meetup, Victor Vieux, dotCloud Inc

Page 17: An Introduction to Kubernetes

Problems with standalone Docker

Load Balancer

Docker Containers

Docker Host

● Running a server cluster on a set of Docker containers, on a single Docker host is vulnerable to single point of failure!

Page 18: An Introduction to Kubernetes

Kubernetes

Page 19: An Introduction to Kubernetes

Kubernetes

● Kubernetes is a platform for hosting Docker containers in a clustered environment with multiple Docker hosts

● Provides container grouping, load balancing, auto-healing, scaling features

● Project was started by Google● Contributors == Google, CodeOS, Redhat,

Mesosphere, Microsoft, HP, IBM, VMWare, Pivotal, SaltStack, etc

Page 20: An Introduction to Kubernetes

Key Concepts of Kubernetes

● Pod - A group of Containers● Labels - Labels for identifying pods● Kubelet - Container Agent● Proxy - A load balancer for Pods● etcd - A metadata service● cAdvisor - Container Advisor provides resource

usage/performance statistics● Replication Controller - Manages replication

of pods● Scheduler - Schedules pods in worker nodes● API Server - Kubernetes API server

Page 21: An Introduction to Kubernetes

Kubernetes Architecture

Overlay Network: 10.1.0.0/16(Flannel, Open vSwitch, etc)

Kubernetes Master

Kubernetes Minion 1

Kubernetes Minion 2

Kubernetes Minion n

Service Network: 172.17.8.0/24

etcd

Docker Registry

API Replication Controllers

Scheduler

Kubelet Proxy

cAdvisor Pods

Docker A Docker B

Page 22: An Introduction to Kubernetes

Kubernetes Master

Kubernetes Master

Kubelet Info Service

API Scheduler Replication Controllers

Page 23: An Introduction to Kubernetes

Kubernetes Minion (Worker Node)

Kubernetes Minion

Kube

let

Proxy

Pod 1 Pod 2 Pod n

cAdv

isor

ContainersContainersContainersContainersContainersContainers

ContainersContainersContainers

Kubernetes ServicesKubernetes

ServicesKubernetes

Services

Page 24: An Introduction to Kubernetes

Kubernetes Component Architecture

https://github.com/GoogleCloudPlatform/kubernetes/blob/master/DESIGN.md

Page 25: An Introduction to Kubernetes

Kubernetes Demo

Page 26: An Introduction to Kubernetes

References

● http://en.wikipedia.org/wiki/Virtualization● http://en.wikipedia.org/wiki/Hypervisor● http://en.wikipedia.org/wiki/LXC● http://www.cs.ucsb.edu/~rich/class/cs290-

cloud/papers/lxc-namespace.pdf● http://en.wikipedia.org/wiki/Cgroups● http://en.wikipedia.org/wiki/AppArmor● http://en.wikipedia.org/wiki/Security-Enhanced_Linux● http://www.lorien.ch/server/chroot.html

Page 27: An Introduction to Kubernetes

References

● SELinux for Everyday Users, PaulWay● http://en.wikipedia.org/wiki/Seccomp● http://en.wikipedia.org/wiki/Chroot● Linux Container Brief for IEEE WG P2302, Boden

Russell● http://kubernetes.io/● https://www.youtube.com/watch?v=Fcb4aoSAZ98● http://www.slideshare.net/enakai/architecture-

overview-kubernetes-with-red-hat-enterprise-linux-71