K3s and Kubernetes in not very many minutes

Kubernetes is a system that manages the lifecycle of containers

K3s is a distribution of Kubernetes

K3s distinguishing features:
- single binary
- small (<50MB)

-Supports ARM (v7, v8, not v6, also x86_64)

Demo!

Install k3s (server)

# generate a token

export K3S_TOKEN=$(openssl rand -base64 32)


# install k3s

curl -Lo /usr/local/bin/k3s https://github.com/rancher/k3s/releases/download/v1.17.4%2Bk3s1/k3s-arm64 && chmod a+x /usr/local/bin/k3s


# start k3s

k3s server

Looking around....

# Create a symlink or alias

alias k='sudo k3s kubectl'

 

# /etc/rancher/k3s/k3s.yaml

 

k get nodes

k describe node <some node>

k get pods --all-namespaces

k describe pod -n kube-system <some pod>

 

 

Install k3s (worker)

export K3S_TOKEN=<your token>

export K3S_URL=https://<server ip>:6443

 

# install k3s

curl -Lo /usr/local/bin/k3s https://github.com/rancher/k3s/releases/download/v1.17.4%2Bk3s1/k3s-arm64 && chmod a+x /usr/local/bin/k3s

 

# start k3s

k3s agent

k3s kubectl get nodes -w 

Deploy a workload

k create namespace nextcloud

k config set-context --current --namespace nextcloud

k create deploy --image=nextcloud nextcloud

k get pods -w 

k get deploy nextcloud -o yaml

k port-forward <pod name> 8080:80

# browse to http://localhost:8080

Break stuff!

k delete pods --all

k get pods -w

k port-forward <pod name> 8080:80

k describe pod <pod name>

Further down the rabbit hole:

Data storage:

- persistent volumes

- host paths

Secrets

Configmaps

Ingress

Daemonsets

Jobs, CronJobs

RBAC

NodePorts

Operators

Questions?

Thanks!

K3s and Kubernetes in not very many minutes

By Sten Turpin

K3s and Kubernetes in not very many minutes

  • 542