Kubernetes Workshop

Matt Fisher

About Deis

  • first multi-host Docker PaaS
  • Heroku-inspired workflow with Docker goodies
  • 100% free (as in beer) and open source
  • leverages best-of-breed software to help deploy containers

Where does Kubernetes fit in?

  • open source
  • orchestration system for Docker containers
  • best-of-breed after testing schedulers in Deis (tech previews)

Installing Kubernetes

  • install virtualbox (v4.3.28, not v5)
  • 
            $ export KUBERNETES_PROVIDER=vagrant
            $ curl -sS https://get.k8s.io | bash
        
  • Alternatively...
  • 
            $ git clone https://github.com/kubernetes/kubernetes
            $ cd kubernetes
            $ git checkout v1.0.6
    
            $ export KUBERNETES_PROVIDER=vagrant
            $ ./cluster/kube-up.sh
        

    Simple Example - Deploy Ubuntu

    
            $ git clone https://github.com/bacongobbler/kubernetes-workshop-examples
            $ cd kubernetes-workshop-examples/ubuntu
            $ ./cluster/kubectl.sh create -f ubuntu.yaml
            $ # wait for it to come into the ready state
            $ kubectl exec ubuntu -- nslookup kubernetes.default
        

    Little Harder - Nginx

  • note: requires openssl and Go
  • 
            $ cd ../nginx
            $ make keys secret
            $ ./cluster/kubectl.sh create -f /tmp/secret.json
            $ ./cluster/kubectl.sh create -f nginx.yml
            $ ./cluster/kubectl get nodes -o json | grep ExternalIP -A 2
            $ ./cluster/kubectl get svc nginxsvc -o json
            $ curl https://nodeip:nodehttpsport -k
        

    Hardest - Clustered Redis

    
            $ cd ../redis
            $ kubectl create -f redis-master.yaml
            $ kubectl create -f redis-sentinel-service.yaml
            $ kubectl create -f redis-controller.yaml
            $ kubectl create -f redis-sentinel-controller.yaml
            $ kubectl scale rc redis --replicas=3
            $ kubectl scale rc redis-sentinel --replicas=3
            $ kubectl delete pods redis-master
        

    A little explanation on that last one...

    1. create an initial master/sentinel pod
    2. create a sentinel service
    3. create redis slaves with a replication controller, bootstrapping from the master
    4. create a redis sentinel replication controller
    5. scale up to 3 replicas
    6. delete the bootstrap pod

    Workshop Time!