需要这个的继续往下看
环境mac os 12.6.2
安装dokcer https://docs.docker.com/desktop/install/mac-install/
安装k8s https://blog.csdn.net/qq_20042935/article/details/124472626 <- 看这位兄弟写的很详细了
安装kubernetes-dashboard
1. 创建命名空间 kubectl create namespace kubernetes-dashboard
2. helm repo add k8s-dashboard https://kubernetes.github.io/dashboard. (helm官方给的, https://artifacthub.io/packages/helm/k8s-dashboard/kubernetes-dashboard )
3. helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --namespace=kubernetes-dashboard (helm官方给的)
4 创建账号 kubectl apply -f dashboard-adminuser.yaml
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
5 生成token kubectl create -f dashboard-secret.yaml --namespace=kubernetes-dashboard
apiVersion: v1 kind: Secret metadata: name: admin-user annotations: kubernetes.io/service-account.name: "admin-user" # 这里填写serviceAccountName type: kubernetes.io/service-account-token
6 启动 ./start.zsh
#!/bin/zsh export POD_NAME=$(kubectl get pods -n kubernetes-dashboard -l "app.kubernetes.io/name=kubernetes-dashboard,app.kubernetes.io/instance=kubernetes-dashboard" -o jsonpath="{.items[0].metadata.name}") echo https://127.0.0.1:8443/ kubectl -n kubernetes-dashboard port-forward $POD_NAME 8443:8443
7 打印token ./token.zsh
#!/bin/zsh TOKEN=$(kubectl -n kubernetes-dashboard describe secret admin-user| awk '$1=="token:"{print $2}') echo $TOKEN
8 打开浏览器. https://127.0.0.1:8443/ 输入token
标签:name,kubernetes,admin,mac,dashboard,io,k8s,os From: https://www.cnblogs.com/zhengzhihua/p/17352172.html