k3s install on Debian

ks3 install

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

Wait for node in ready state

k3s kubectl get nodes
# watch'k3s kubectl get pod --all-namespaces'

Describe the node token

cat /var/lib/rancher/k3s/server/node-token

Add to kubectl on local machine

kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml get nodes

cat /etc/rancher/k3s/k3s.yaml

# I named the cluster as "k3s"
kubectl config use-context k3s

Check connection

If you configure properly, you will see the node desecription when exec kubectl cluster-info

kubectl cluster-info

Kubernetes control plane is running at https://xxx.com:6443
CoreDNS is running at https://xxx.com:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://xxx.com:6443/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy

Kubernetes Dashboard install

helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard

Expose port

kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443

Create dashboard token

# kubectl -n NAMESPACE create token SERVICE_ACCOUNT
# kubectl get serviceAccounts (List all service account)
# I install on "default" service account, namespace is kubernetes-dashboard

kubectl -n kubernetes-dashboard create token default