Training Guide

Deploy K3s

k3sup install --ip=10.68.0.143 --user=root --k3s-version=v1.18.8+k3s1

Kubernetes

Pod

kubectl apply -f pod.yaml
kubectl logs myapp-pod
kubectl get po -w
kubectl delete po myapp-pod

Deployment

  • we can launch random stuff, but this isn't repeatable
kubectl create deploy nginx --image=nginx:1.16-alpine
kubectl get deploy
kubectl get po
kubectl delete deploy/nginx
  • launch again using kustomize templates
kubectl create deploy nginx --image=nginx:1.16-alpine --dry-run -o yaml > deployment/base/deployment.yaml
kubectl apply -k deployment/base
kubectl get deploy
kubectl get po
  • describe pod, look at the image
  • scale deployment manually
kubectl scale deploy/nginx --replicas=3
kubectl rollout status deploy/nginx
kubectl get deploy
kubectl get po
  • upgrade with bad image
kubectl set image deploy/nginx nginx=nginx:1.17-alpne --record
kubectl rollout status deploy/nginx
kubectl get po
kubectl rollout undo deploy/nginx
  • redo upgrade from manifest
kustomize build deployment/base
  • edit base to change image and then apply
kubectl apply -k deployment/base
  • how can we use this for different environments?
kustomize build deployment/overlay/staging
kustomize build deployment/overlay/production

kubectl apply -k deployment/overlay/staging
kubectl apply -k deployment/overlay/production
kubectl get deploy
kubectl get pods

ConfigMaps

  • show ConfigMaps
  • explain what they're for
  • explain how they're generated by Kustomize
  • they'll show up later

Services

  • show services listening as NodePort
  • go look at them
curl -I training-a:<port>

Ingress

  • show deployment/overlay/ingress/single/ingress.yaml
kubectl apply -k deployment/overlay/ingress/single
kubectl get ingress
kustomize build deployment/overlay/ingress/fanout
kubectl apply -k deployment/overlay/ingress/fanout 
kustomize build rancher-demo/base
kubectl apply -k rancher-demo/base

Rancher

Server Deploy

docker run -d --restart=unless-stopped -p 80:80 -p 443:443 -v /opt/rancher:/var/lib/rancher rancher/rancher:v2.4.5

Node Deploy

  • Show how we would deploy an RKE cluster
  • Import the training-a k3s cluster

Rancher Server Walkthrough

  • Clusters
  • Authentication & Security
  • Storage
  • Projects
  • Namespaces
  • Catalogs
  • CLI/API/Kubectl

Application Deployment

  • show workloads on running cluster
  • edit them / delete them
  • redeploy monachus/rancher-demo as a workload
    • expose port 8080
  • put an Ingress in front of it
    • use training-a.cl.monach.us
  • scale it

Rancher Application Catalog

  • use the Hadoop example