as of 01/06/2021: you have to use ubuntu 18. Seems like ubuntu 20 has an incompatible iptables version. You can verify that after setting up k3s, by running k3s check check-config.
Whats the problem? Thou it seems to work, I run into the situation where DNS lookups timed out. To verify that your output should look like this.
kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yam
root@ub1:~# kubectl exec -i -t dnsutils -- nslookup kubernetes.default
Server: 10.43.0.10
Address: 10.43.0.10#53
Name: kubernetes.default.svc.cluster.local
Address: 10.43.0.1
apt update
cat >> /etc/hosts << EOF
134.122.57.120 ub1
134.122.57.118 ub2
134.122.57.119 ub3
EOF
You may bootstrap with https://github.com/alexellis/k3sup which is aweseome, but I decided to go with k3s native as I wanted a bit more of a granularity.
export INSTALL_K3S_VERSION="v1.19.10+k3s1"
curl -sfL https://get.k3s.io | sh -s - --disable=traefik
mkdir ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
export KUBECONFIG=~/.kube/config
kubectl config set-context default
kubectl get node -o wide
cat /var/lib/rancher/k3s/server/node-token
export token=$(cat /var/lib/rancher/k3s/server/node-token)
export token=
export INSTALL_K3S_VERSION="v1.19.10+k3s1"
curl -sfL https://get.k3s.io | K3S_URL="https://ub1:6443" K3S_TOKEN=$token sh -
/usr/local/bin/k3s-agent-uninstall.sh (in case you want to start over)kubectl run -i -t busybox --image=busybox --restart=Neverwget https://raw.githubusercontent.com/longhorn/longhorn/v1.1.1/deploy/longhorn.yaml > lh.yaml
vi lh.yaml
- name: KUBELET_ROOT_DIR
value: /var/lib/rancher/k3s/agent/kubelet ..... /var/lib/kubeletcurl -L https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64 -# -o /usr/local/bin/stern && chmod u+x /usr/local/bin/stern
curl -L# https://github.com/ahmetb/kubectx/releases/download/v0.9.3/kubens_v0.9.3_linux_x86_64.tar.gz -o kubens.tar.gz && tar -xvf kubens.tar.gz && mv ./kubens /usr/local/bin
curl -L# https://github.com/ahmetb/kubectx/releases/download/v0.9.3/kubectx_v0.9.3_linux_x86_64.tar.gz -o kubectx.tar.gz && tar -xvf kubectx.tar.gz && mv ./kubectx /usr/local/bin
###curl -L# https://github.com/cloudnativelabs/kube-shell/releases/download/v0.0.21/kube-shell-0.0.21.tar.gz -o kube-shell.tar.gz && tar -xvf kube-shell.tar.gz && mv kube-shell /usr/local/bin
echo 'alias k=/usr/local/bin/kubectl' | tee -a ~/.bash_aliases
echo "source <(kubectl completion bash)" | tee -a ~/.bashrc
complete -F __start_kubectl k
echo "export KUBECONFIG=~/.kube/config" | tee -a ~/.bashsrc
source ~/.bashrc
### fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
source ~/.bashrcOne of the nicer facts of k3s is, that it deploys a loadbalancer out of the box.
image: docker.io/rancher/klipper-lb:v0.1.2
root@w1:~# kubectl get pods
NAME READY STATUS RESTARTS AGE
svclb-crate-5fd1dbb1-9bf8-4212-ad68-6f8f156df934-jv95d 2/2 Running 1 4m35s
svclb-crate-5fd1dbb1-9bf8-4212-ad68-6f8f156df934-kcqdw 2/2 Running 1 4m35s
svclb-crate-5fd1dbb1-9bf8-4212-ad68-6f8f156df934-dmlwz 2/2 Running 0 4m35s
- containerID: containerd://186e1539a9b566f0520601499b887c78153e94211148f47951826f033e713d43
image: docker.io/rancher/klipper-lb:v0.1.2
imageID: docker.io/rancher/klipper-lb@sha256:2fb97818f5d64096d635bc72501a6cb2c8b88d5d16bc031cf71b5b6460925e4a
lastState:
terminated:
containerID: containerd://71b8253df59dc1ff28bafde2eaaeb05f85483f6301808c7a55eb6beb5027e034
exitCode: 4
finishedAt: "2021-06-02T08:26:18Z"
reason: Error
startedAt: "2021-06-02T08:26:18Z"
name: lb-port-5432
ready: true
restartCount: 1
started: true
state:
running:
startedAt: "2021-06-02T08:26:18Z"
hostIP: 10.136.16.4
phase: Running
podIP: 10.42.2.18
podIPs:
- ip: 10.42.2.18
qosClass: BestEffort
startTime: "2021-06-02T08:26:16Zcroud config show
croud config profiles use dev
croud clusters list -r 7961f447a9bb44b98ffdf214fe33ebf8.edge --sudo
croud login
croud clusters list -r 7961f447a9bb44b98ffdf214fe33ebf8.edge