Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Kubernetes

Avatar for Edu Garcia Edu Garcia
October 17, 2015

Introduction to Kubernetes

Quick introduction to Kubernetes. Made for the second Sevilla Google Developer Group meetup: http://old.sevilladevelopers.com/schedule

Avatar for Edu Garcia

Edu Garcia

October 17, 2015
Tweet

Other Decks in Technology

Transcript

  1. Table of Contents • Quick introduction to containers • What

    is Kubernetes? • Why Kubernetes? • General overview • Proof of concept
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. Defining a service apiVersion: v1 kind: Service metadata: labels: name:

    nginx name: nginx-service spec: ports: - port: 80 selector: name: nginx type: LoadBalancer
  9. 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