kubernetes - k3s
2024-12-19 / 2024-12-20 | ||
notes... in progress...
installs
curl -sfL https://get.k3s.io | sh -
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
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
# "kubernetes-dashboard" has been added to your repositories
# Release "kubernetes-dashboard" does not exist. Installing it now.
# NAME: kubernetes-dashboard
# LAST DEPLOYED: Thu Dec 19 22:31:36 2024
# NAMESPACE: kubernetes-dashboard
# STATUS: deployed
# REVISION: 1
# TEST SUITE: None
# NOTES:
# *************************************************************************************************
# *** PLEASE BE PATIENT: Kubernetes Dashboard may need a few minutes to get up and become ready ***
# *************************************************************************************************
# Congratulations! You have just installed Kubernetes Dashboard in your cluster.
# To access Dashboard run:
# kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443
# NOTE: In case port-forward command does not work, make sure that kong service name is correct.
# Check the services in Kubernetes Dashboard namespace using:
# kubectl -n kubernetes-dashboard get svc
# Dashboard will be available at:
# https://localhost:8443
login
nano dashboard-ServiceAccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
kubectl apply -f dashboard-ServiceAccount.yaml
nano dashboard-ClusterRoleBinding.yaml
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-ClusterRoleBinding.yaml
token erzeugen
kubectl -n kubernetes-dashboard create token admin-user
long live token
nano dashboard-Secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: admin-user
namespace: kubernetes-dashboard
annotations:
kubernetes.io/service-account.name: "admin-user"
type: kubernetes.io/service-account-token
kubectl apply -f dashboard-Secret.yaml
#token erzeugen
kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath="{.data.token}" | base64 -d