blog

12020-12-08

SEAN K.H. LIAO

kubernetes

tldr: kind for local testing, k3s for dead easy cluster setup, kubeadm for a customized install

all are tested with a Arch Linux host created with:

gcloud compute instances create k0 \
    --image-project arch-linux-gce --image-family arch \
    --machine-type e2-medium

single machine

kind
sudo pacman -Syu docker kubectl
sudo systemctl enable --now docker
sudo usermod -aG docker $(whoami)
newgrp docker

sudo curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64
sudo chmod +x /usr/local/bin/kind
kind create cluster

kubectl get --all-namspaces all
minikube

minikube

sudo pacman -Syu docker kubectl
sudo systemctl enable --now docker
sudo usermod -aG docker $(whoami)
newgrp docker

sudo curl -Lo /usr/local/bin/minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo chmod +x /usr/local/bin/minikube
minikube start

kubectl get --all-namspaces all
microk8s

This needs snap... too much of a PITA to install

multi machine

k3s

k3s

sudo pacman -Syu which

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

kubectl get --all-namspaces all
kubeadm
sudo pacman -Syu containerd kubeadm kubelet kubectl
sudo rm /etc/sysctl.d/60-gce-network-security.conf
sudo sysctl --system
sudo modprobe br_netfilter
sudo mkdir -p /etc/containerd
cat << EOF | sudo tee /etc/containerd/config.toml
version = 2
[plugins."io.containerd.grpc.v1.cri".cni]
  bin_dir = "/usr/lib/cni"
EOF
sudo systemctl enable --now containerd
sudo systemctl enable kubelet

sudo kubeadm init --pod-network-cidr=10.244.0.0/16
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

sudo kubectl --kubeconfig /etc/kubernetes/admin.conf get --all-namespaces all
cilium
sudo pacman -Syu containerd kubeadm kubelet kubectl
sudo rm /etc/sysctl.d/60-gce-network-security.conf
echo 'net.ipv4.conf.lxc*.rp_filter = 0' | sudo tee /etc/sysctl.d/99-override_cilium_rp_filter.conf
sudo systemctl restart systemd-sysctl
sudo modprobe br_netfilter
sudo mkdir -p /etc/containerd
echo 'KUBELET_ARGS=' | sudo tee /etc/kubernetes/kubelet.env
sudo systemctl enable --now containerd
sudo systemctl enable kubelet

sudo kubeadm init
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.9/install/kubernetes/quick-install.yaml

sudo kubectl --kubeconfig /etc/kubernetes/admin.conf get --all-namespaces all
k0s

k0s

sudo pacman -Syu kubectl
echo 127.0.0.1 localhost | sudo tee -a /etc/hosts

sudo curl -Lo /usr/local/bin/k0s https://github.com/k0sproject/k0s/releases/download/v0.8.1/k0s-v0.8.1-amd64
sudo chmod +x /usr/local/bin/k0s
sudo k0s server

sudo kubectl --kubeconfig /var/lib/k0s/pki/admin.conf get --all-namespaces all
kops

kOps

This is for creating your self managed kubernetes clusters in cloud environments, not exactly what I want to testing today. Short setup though.

kubespray

kubespray

Similar to kOps but uses ansible and slightly more generic? Very long setup.