Kubernetes

A quick introduction

Frederic Hemberger

Quick facts

  • Released by Google in 2014
  • Successor to Google's container management »Borg«
  • Written in Go, Open Source
  • Infrastructure independent
  • Runs docker and rkt containers
  • Declarative definition of resources

Infrastructure independent

  • local (via »minikube«)
  • bare metal clusters
  • Google Container Engine
  • AWS (via »kops«)
  • OpenStack

Federated clusters

Across multiple availability zones or infrastructure providers

Elements of a Kubernetes cluster

                        
apiVersion: v1
kind: Pod
metadata:
  name: frontend
spec:
  containers:
  - image: nginx
    name: nginx
    ports:
    - containerPort: 80
      protocol: TCP
                        
                    
                        
apiVersion: v1
kind: Pod
metadata:
  name: frontend
spec:
  containers:
  - image: nginx
    name: nginx
    ports:
    - containerPort: 80
      protocol: TCP
  - image: mydockeraccount/wordpress
    name: wordpress
                        
                    
                        
apiVersion: v1
kind: Service
metadata:
  name: myapp-prod
spec:
  ports:
  - port: 80
  selector:
    app: my-application
    env: production
  # Only accessible inside the cluster
  type: NodePort
  # Use load balancer (e.g. autoconfigured on AWS)
  type: LoadBalancer
                        
                    
                        
apiVersion: v1
kind: Service
metadata:
  name: external-service
spec:
  ports:
  - port: 80
  type: ExternalName
  externalName: external-service.prod.example.com
                        
                    
                        
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 3
  template:
    spec:
      containers:
      - image: nginx
        name: nginx
        ports:
        - containerPort: 80
          protocol: TCP
                        
                    

And there is more …

  • Clusters
  • ComponentStatuses
  • ConfigMaps
  • DaemonSets
  • Deployments
  • Endpoints
  • Events
  • HorizontalPodAutoscalers
  • Ingresses
  • Jobs
  • LimitRanges
  • Namespaces
  • NetworkPolicies
  • Nodes
  • PersistentVolumeClaims
  • PersistentVolumes
  • Pods
  • PodSecurityPolicies
  • PodTemplates
  • ReplicaSets
  • ReplicationControllers
  • ResourceQuotas
  • ScheduledJobs
  • Secrets
  • ServiceAccounts
  • Services
  • StatefulSets
  • StorageClasses
  • ThirdPartyResources

Batteries included

  • Service discovery
  • Health check endpoints
  • Centralized host/pod metrics (»heapster«)
  • Centralized logging endpoint per node
    (collects stdout/stderr)
  • Storage adapters (GCE, AWS, NFS, flocker, glusterfs, …)
  • Authorization based on service accounts

Getting started

  • Documentation: kubernetes.io
    (Site structure is sometimes not very intuitive, use the search function)
  • Install Minikube to run Kubernetes locally
  • Install kubectl, the Kubernetes CLI

Other tools and resources

Thank you!

Frederic Hemberger
frederic-hemberger.de
@fhemberger