赞
踩
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout kube-dashboard.key -out kube-dashboard.crt -subj "/CN=dashboard.kube.com/O=kubernetes.dashboard.domain.com"
kubectl create secret tls dashboard-tls --key kube-dashboard.key --cert kube-dashboard.crt -n kubernetes-dashboard
kubectl get secret -n kubernetes-dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.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 --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: dashboard-ingress namespace: kubernetes-dashboard annotations: nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" spec: ingressClassName: "nginx" tls: - hosts: - kubernetes.dashboard.domain.com secretName: dashboard-tls rules: - host: kubernetes.dashboard.domain.com http: paths: - path: / pathType: Prefix backend: service: name: kubernetes-dashboard port: number: 443
127.0.0.1 kubernetes.dashboard.domain.com
https://kubernetes.dashboard.domain.com/#/workloads?namespace=default
```bash
jiangzhongzhou@ZBMac-C02CW08SM kubelet-dashbord % kubectl -n kubernetes-dashboard create token admin-user
eyJhbGciOiJSUzI1NiIsImtpZCI6Iks3dExUb1pMZDA2MGJnMy1xQ0JLSy1PZnNfaEVtSzZ6N2Q0NU81ald2ZGsifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNzE2MjY0OTIxLCJpYXQiOjE3MTYyNjEzMjEsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJhZG1pbi11c2VyIiwidWlkIjoiYWQ5ZmIwNmItZmM4MS00ZWJhLWFiODktMTJmY2I1MTEzZjE4In19LCJuYmYiOjE3MTYyNjEzMjEsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlcm5ldGVzLWRhc2hib2FyZDphZG1pbi11c2VyIn0.09b9KFzDRDBezgLMj3CmWHHCDmW5bQumKQRq49o22ly-mtx6U15kP31gwz1XfW-_faQAPnf4enYICnw1dFKUhJFp7X-oX0Pdwc5Nv-rBAPFWOIksccc0720LZOCoITpd7uICV9_qstpZkgZj5_pm0uI1SfbzD4QyJEJZGO89-RUvut6beGVXL1dkL4iSyvrthiZWOiBFK7K_kCGNp0hIobrktAbxyfKAhw39VWL9QcueaimdliEZwqELMtwxXsXofwGqEBoFawVUlBMgR9Is1cwn31PfK-NSEI_VH_kt43w_-UlQ_JlFDKLZixa9RK_kKRGSzBtFCt-m0NpL_mBW5g
在浏览器页面填写进token即可
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。