Kubernetes Made Simple with K3S

Image for post
Image for post

Kubernetes Made Simple with K3S

Required Hardware

Prepare the Controller

curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl"
curl -sLS https://get.k3sup.dev | sh

Install K3S

k3sup install --ip $SERVER_IP --user $USERcp ${pwd}kubeconfig ~/.kubeconfig
export KUBECONFIG=~/.kubeconfig
k3sup join --ip $NODE_IP --server-ip $SERVER_IP --user $USERNAME
kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k3s-node1 Ready <none> 14h v1.17.2+k3s1 49.12.45.26 <none> Debian GNU/Linux 10 (buster) 4.19.0-8-amd64 containerd://1.3.3-k3s1
k3s-server Ready master 14h v1.17.2+k3s1 49.12.45.6 <none> Debian GNU/Linux 10 (buster) 4.19.0-8-amd64 containerd://1.3.3-k3s1
k3s-node2 Ready <none> 14h v1.17.2+k3s1 49.12.64.126 <none> Debian GNU/Linux 10 (buster) 4.19.0-8-amd64 containerd://1.3.3-k3s1

Install Dashboard

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
apiVersion: v1
kind: Namespace
metadata:
name: kubernetes-dashboard
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
---
kubectl apply -f dashboard_accounts.yml
kubectl proxy&
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user-token | awk '{print $1}')
Image for post
Image for post

Conclusion

Written by

IT Project Manager & Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store