当前位置:   article > 正文

Kubernates-dashbord-安装

Kubernates-dashbord-安装
  • 生成证书

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
  • 1
  • 2
  • 3
  • 4
  • 执行一下命令
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
  • 1
  • 执行一下命令
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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 配置本机域名访问
127.0.0.1 kubernetes.dashboard.domain.com
  • 1
  • 访问地址
    https://kubernetes.dashboard.domain.com/#/workloads?namespace=default
  • 生成token
```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
  • 1
  • 2
  • 3
  • 4
  • 5

在浏览器页面填写进token即可

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/635234
推荐阅读
相关标签
  

闽ICP备14008679号