Demo

Kubernetes Basics

by Matt Boersma - mboersma@deis.com
thanks to Gerred Dillon, Jason Hansen, and Kelsey Hightower!

Kubernetes Is

“Kubernetes is an open-source system for managing containerized applications across multiple hosts in a cluster. Kubernetes provides mechanisms for application deployment, scheduling, updating, maintenance, and scaling.”

Kubernetes Is


$ kubectl
kubectl controls the Kubernetes cluster manager.

Find more information at https://github.com/kubernetes/kubernetes.

Usage:
  kubectl [flags]
  kubectl [command]

Available Commands:
  get            Display one or many resources
  describe       Show details of a specific resource or group of resources
  create         Create a resource by filename or stdin
...
					

Kelsey's K8S Kore Koncepts

  • Containers
  • Nodes
  • Pods
  • Labels
  • Services

Containers

  • Unix processes, *NOT* VMs
  • Application + dependencies = image
  • Runtime environment (cgroups, namespaces, env vars)

FROM alpine:3.3

# install common packages
RUN apk add --update-cache curl bash openssl sudo && rm -rf /var/cache/apk/*

# install etcdctl and confd
RUN apk add --update-cache curl tar \
    && curl -sSL https://github.com/coreos/etcd/releases/download/v2.2.1/etcd-v2.2.1-linux-amd64.tar.gz \
    | tar -vxz -C /usr/local/bin --strip=1 etcd-v2.2.1-linux-amd64/etcdctl \
    && chown root:root /usr/local/bin/etcdctl \
    && curl -sSL -o /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v0.10.0/confd-0.10.0-linux-amd64 \
    && chmod +x /usr/local/bin/confd

# define execution environment
CMD ["/app/bin/boot"]
EXPOSE 8000
						

Node

Runs containers and proxies service requests.
Supporting processes:

  • docker
  • kubelet
  • proxy

Pod

Represents a logical application.

  • One or more containers
  • Shared namespace

Replication Controller

Manages a replicated set of pods

  • Creates pods from a template
  • Makes sure the desired number of pods are running
  • Self-healing

Service

Service discovery for pods.

  • Proxy runs on each node
  • Virtual IP per service (no port collisions)
  • Basic round-robin algorithm
  • Dynamic backends based on label queries

K8S Runs Everywhere

Demo: Create a Vagrant Cluster

Demo: Install and Scale an RC

Demo: Install Deis v2 alpha