zoukankan      html  css  js  c++  java
  • Kubernetes(十一) 部署doshboard

    1. 下载配置文件

      
      cd /opt/k8s/yml
      wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc4/aio/deploy/recommended.yaml
      mv  recommended.yaml dashboard-recommended.yaml
      
      

    从 1.7 开始,dashboard 只允许通过 https 访问,采用自动生成的证书有的浏览器不支持,所以需要生成自签名的证书

    1. 生成自签名证书

      mkdir -p /opt/k8s/yml/dashbaord
      cd /opt/k8s/yml/dashbaord
      
      openssl genrsa -des3 -passout pass:over4chars -out dashboard.pass.key 2048
      openssl rsa -passin pass:over4chars -in dashboard.pass.key -out dashboard.key
      rm dashboard.pass.key
      openssl req -new -key dashboard.key -out dashboard.csr
      openssl x509 -req -sha256 -days 365 -in dashboard.csr -signkey dashboard.key -out dashboard.crt
      
      
    2. 使用自签名证书生成secret

      cd /opt/k8s/yml/dashbaord
      
      root@master:/opt/k8s/yml/dashbaord# kubectl create secret generic kubernetes-dashboard-certs --from-file=dashboard.key --from-file=dashboard.crt -n kubernetes-dashboard
      
      
    3. 修改配置文件

      把dashboard-recommended.yaml中创建kubernetes-dashboard-certs的部分去掉

      
       #---
      
      #apiVersion: v1
      #kind: Secret
      #metadata:
      #  labels:
      #    k8s-app: kubernetes-dashboard
      #  name: kubernetes-dashboard-certs
      #  namespace: kubernetes-dashboard
      #type: Opaque
      
      
      
    4. 启动dashboard

      cd /opt/k8s/yml
      root@master:/opt/k8s/yml# kubectl create -f dashboard-recommended.yaml  
      
      
    5. 通过 port forward 访问 dashboard

      cd /opt/k8s/yml
      kubectl port-forward -n kubernetes-dashboard  svc/kubernetes-dashboard 4443:443 --address 0.0.0.0
      
      
    6. 浏览器访问 URL:https://192.168.0.107:4443

    7. 创建登录 Dashboard 的 token

      kubectl create sa dashboard-admin -n kube-system
      kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
      ADMIN_SECRET=$(kubectl get secrets -n kube-system | grep dashboard-admin | awk '{print $1}')
      DASHBOARD_LOGIN_TOKEN=$(kubectl describe secret -n kube-system ${ADMIN_SECRET} | grep -E '^token' | awk '{print $2}')
      echo ${DASHBOARD_LOGIN_TOKEN}
      
      
    8. 使用token值登陆

  • 相关阅读:
    Go语言开发Windows应用
    go 调用windows dll 的方法
    thinkPHP5 命名空间别名
    thinkPHP5 类库包注册
    thinkphp5 默认配置代码
    edusoho twig 引入文件功能
    edusoho 查找网址对应的控制器和模板页面
    启动Nginx 出现 nginx: [emerg] unknown directive "锘?user" 错误
    eduSOHO 首页模板 全部课程模块代码
    twig 模板控制器对应列表
  • 原文地址:https://www.cnblogs.com/gaofeng-henu/p/12302462.html
Copyright © 2011-2022 走看看