“Introduction to kubernetes”
Edu García
Developer @godraude

eduardo@bitnami.com
Table of Contents
• Quick introduction to containers
• What is Kubernetes?
• Why Kubernetes?
• General overview
• Proof of concept
Quick intro to containers
Linux containers and docker
• Linux containers
• Provides isolated namespaces

• Runs on top of the system kernel

• Less overhead than virtual machines

• Docker
• Provides an api to manage linux containers
What is kubernetes
What is kubernetes?
• A system for managing containerized applications across a
cluster of nodes
• Started by google in 2014

• Open-source project written in GO

• Version 1.0 released July 2015

• Benefits
• Automatic deployment

• Scalable

• Portable

• Lightweight
Why kubernetes?
Architecture
General overview
Pods
Pods
• A pod is a collection of containers that run on a host. It’s the
smallest unit in kubernetes.
• It can be seeing as a virtualised host
• Each pod has an IP address and full access to others
computers or containers in the same network
• It groups tightly coupled applications
• They share PID namespace, network and hostname

• They have access to shared volumes

• Each application is a container itself

• When a node dies, the scheduled pod dies with it
Pod definition
It’s a definition of a desired state. Kubernetes is in charge of having the
current state as the desired state.
Template example:
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
name: nginx
spec:
containers:
- image: bitnami/nginx
name: nginx
ports:
- containerPort: 80
Replication controller
Replication Controller
• Replication Controller
• It ensures that a number of pod replicas are running

• Creates new pods from a template
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-controller
spec:
replicas: 2
selector:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: bitnami/nginx
ports:
- containerPort: 80
Services
Services
• Services
• Defines a a policy to access a set of pods

• If a pod goes down and a new one is created, it will still be
accesible from the outside through its service

• The set of pods to which a service applies are defined by a
label
Defining a service
apiVersion: v1
kind: Service
metadata:
labels:
name: nginx
name: nginx-service
spec:
ports:
- port: 80
selector:
name: nginx
type: LoadBalancer
Interacting with the cluster
Create a pod:
List all pods:
Delete pod by name:
$ kubectl get pods
$ kubectl create -f nginx.yaml
$ kubectl delete pod nginx
Proof of concept
https://github.com/bitnami/bitnami-docker/tree/master/gke/redmine
1) MariaDB
2) Redmine
3) Final result
Thanks
Edu García
@godraude

eduardo@bitnami.com

Quick introduction to Kubernetes

  • 1.
  • 2.
    Table of Contents •Quick introduction to containers • What is Kubernetes? • Why Kubernetes? • General overview • Proof of concept
  • 3.
    Quick intro tocontainers
  • 4.
    Linux containers anddocker • Linux containers • Provides isolated namespaces • Runs on top of the system kernel • Less overhead than virtual machines • Docker • Provides an api to manage linux containers
  • 5.
  • 6.
    What is kubernetes? •A system for managing containerized applications across a cluster of nodes • Started by google in 2014 • Open-source project written in GO • Version 1.0 released July 2015 • Benefits • Automatic deployment • Scalable • Portable • Lightweight
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    Pods • A podis a collection of containers that run on a host. It’s the smallest unit in kubernetes. • It can be seeing as a virtualised host • Each pod has an IP address and full access to others computers or containers in the same network • It groups tightly coupled applications • They share PID namespace, network and hostname • They have access to shared volumes • Each application is a container itself • When a node dies, the scheduled pod dies with it
  • 13.
    Pod definition It’s adefinition of a desired state. Kubernetes is in charge of having the current state as the desired state. Template example: apiVersion: v1 kind: Pod metadata: name: nginx labels: name: nginx spec: containers: - image: bitnami/nginx name: nginx ports: - containerPort: 80
  • 14.
  • 15.
    Replication Controller • ReplicationController • It ensures that a number of pod replicas are running • Creates new pods from a template apiVersion: v1 kind: ReplicationController metadata: name: nginx-controller spec: replicas: 2 selector: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: bitnami/nginx ports: - containerPort: 80
  • 16.
  • 17.
    Services • Services • Definesa a policy to access a set of pods • If a pod goes down and a new one is created, it will still be accesible from the outside through its service • The set of pods to which a service applies are defined by a label
  • 18.
    Defining a service apiVersion:v1 kind: Service metadata: labels: name: nginx name: nginx-service spec: ports: - port: 80 selector: name: nginx type: LoadBalancer
  • 19.
    Interacting with thecluster Create a pod: List all pods: Delete pod by name: $ kubectl get pods $ kubectl create -f nginx.yaml $ kubectl delete pod nginx
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.