Code with Abrar


https://chatgpt.com/c/6876ac24-91ac-8013-99ff-f0bb0833d27d

curl -sfL https://get.k3s.io | sh - 
Bash
sudo k3s kubectl get node
Bash
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=$HOME/.kube/config      # add this to your shell RC
Bash
curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

# add the repo and install the chart
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/

helm repo update

helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard   --namespace kubernetes-dashboard --create-namespace

kubectl -n kubernetes-dashboard port-forward         svc/kubernetes-dashboard-kong-proxy 8443:443
Bash
curl -K https://localhost:8443
Bash

Setup the dashboard service account and token key

cat <<'EOF' | kubectl apply -f -
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
EOF
Bash
kubectl -n kubernetes-dashboard create token admin-user
Bash