Day 1 - First Half

Setup

Repositories

Course Materials: https://github.com/praparn/kubernetes_20180701 
Docker Hub: https://hub.docker.com/u/labdocker/ 

Workshop 1: Install minikube

Install Oracle VirtualBox or DockerToolbox first.

$ brew cask install minikube
$ kubectl get-k8s-versions
$ minikube config set kubernetes-version v1.9.0
$ minikube start --vm-driver=virtualbox profile=minikubelab1
$ kubectl config get-contexts
$ kubectl config use-context minikube

Kubernetes tends to be stable at every other minor versions i,e. v1.7.0, 1.9.0, 1.11.0, ...

If minikube stucks at 'Starting cluster components...', check out this solution.

$ minikube status
$ minikube ip
$ minikube ssh
  $ docker version
$ kubectl get nodes
$ kubectl get cs

Kubectl command syntax are kubectl Verb Object vs. docker Object Verb 

$ kubectl run webtest --image=labdocker/nginx:latest --port=80
$ kubectl expose deployment webtest --target-port=80 --type=NodePort
$ kubectl get pods
$ kubectl get deployment
$ kubectl get svc
$ kubectl describe svc
$ kubectl get svc webtest
$ kubectl describe svc webtest
$ curl http://192.168.99.100:30930

To enable autocomplete for kubectl, check out this guide.

Cloud Native Landscape

CNCF Cloud Native Interactive Landscape

Kubernetes is now a project of CNCF, after Google invented it.

Cloud Native Landscape Diagram (Full Resolution)

What are the best Docker orchestration tools?

In Thailand, the green bank is going for OpenShift while purple bank is going for Kubernetes.

Alternative Playground

Introduction

What is Orchestrator

  • Align business request with Application/Data/Infrastructure
  • Centralized management for:
    • Resource Pool
    • Automated Workflow
    • Provisioning
    • Scale Up/Down
    • Monitoring
    • etc.

Why is Orchestrator

  • Production must be cluster
  • Microservices architecture
  • Stateful applications will run on stateless architecture
  • Scale up/down

Kubernetes Introduction

Kubernetes Features

  • Automatic Binpacking
    • If a pod reaches memory limit, it will be terminated and will be restarted on another pod if restart flag was set.
  • Horizontal Pods Autoscaling (HPA)
    • Docker Swarm on Desktop does not have HPA. But Swarm on all cloud providers have HPA.
  • Automated Rollout and Rollbacks
    • Ensue no downtime when upgrading /downgrading
  • Storage Orchestrator
    • Local/Network/Cloud
    • Support dynamic provisioning of storage class
  • Self-healing
    • By Replication Controller
  • Service Discovery and Load Balancing
    • Load balance by kube-proxy
  • Secret and Configuration Management
    • ConfigMap allows environment configurable

Kubernetes Architecture

https://thenewstack.io/kubernetes-an-overview/ 

image-1531021210348.png

image-1531021227969.png

Etcd (Open-source): Key-value database for keep state of nodes/Pods/Container