Code Monkey home page Code Monkey logo

k8s-intro-training's Introduction

Training Guide

Deploy K3s

The install.sh script provides a convenient way to download K3s and add a service to systemd or openrc.

To install k3s as a service just run:

curl -sfL https://get.k3s.io | sh -

A kubeconfig file is written to /etc/rancher/k3s/k3s.yaml and the service is automatically started or restarted. The install script will install K3s and additional utilities, such as kubectl, crictl, k3s-killall.sh, and k3s-uninstall.sh, for example:

sudo kubectl get nodes

K3S_TOKEN is created at /var/lib/rancher/k3s/server/node-token on your server. To install on worker nodes we should pass K3S_URL along with K3S_TOKEN or K3S_CLUSTER_SECRET environment variables, for example:

curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=XXX sh -

Kubernetes

Pod

  • criar namespace kubectl create namespace suse-k8s
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

Load Balancer (metalLB)

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/metallb.yaml

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

k8s-intro-training's People

Contributors

joshwget avatar mrajashree avatar neuhauss avatar oskapt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.