温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

kubernetes怎么安装部署Dashboard

发布时间:2020-06-02 11:12:25 来源:亿速云 阅读:1138 作者:Leah 栏目:系统运维

kubernetes怎么安装部署Dashboard?相信大部分人都还不知道怎么安装部署,为了让大家学会,给大家总结了以下内容。

#在运维主机上运行
k8s-yaml]# docker pull k8scn/kubernetes-dashboard-amd64:v1.8.3
k8s-yaml]# docker images|grep dashboard
k8s-yaml]# docker tag fcac9aa03fd6 harbor.od.com/public/dashboard:v1.8.3
k8s-yaml]# docker push test-harbor.cedarhd.com/public/dashboard:v1.8.3
k8s-yaml]# mkdir dashboard
k8s-yaml]# cd dashboard/

#创建四个yaml文件
dashboard]# vi rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    k8s-app: kubernetes-dashboard
    addonmanager.kubernetes.io/mode: Reconcile
  name: kubernetes-dashboard-admin
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kubernetes-dashboard-admin
  namespace: kube-system
  labels:
    k8s-app: kubernetes-dashboard
    addonmanager.kubernetes.io/mode: Reconcile
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard-admin
  namespace: kube-system

-------------------------------------------------------------------------------------

dashboard]# vi dp.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
  labels:
    k8s-app: kubernetes-dashboard
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
spec:
  selector:
    matchLabels:
      k8s-app: kubernetes-dashboard
  template:
    metadata:
      labels:
        k8s-app: kubernetes-dashboard
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      priorityClassName: system-cluster-critical
      containers:
      - name: kubernetes-dashboard
        image: test-harbor.cedarhd.com/public/dashboard:v1.8.3
        resources:
          limits:
            cpu: 100m
            memory: 300Mi
          requests:
            cpu: 50m
            memory: 100Mi
        ports:
        - containerPort: 8443
          protocol: TCP
        args:
          # PLATFORM-SPECIFIC ARGS HERE
          - --auto-generate-certificates
        volumeMounts:
        - name: tmp-volume
          mountPath: /tmp
        livenessProbe:
          httpGet:
            scheme: HTTPS
            path: /
            port: 8443
          initialDelaySeconds: 30
          timeoutSeconds: 30
      volumes:
      - name: tmp-volume
        emptyDir: {}
      serviceAccountName: kubernetes-dashboard-admin
      tolerations:
      - key: "CriticalAddonsOnly"
        operator: "Exists"

-------------------------------------------------------------------------------------

dashboard]#vi svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
  labels:
    k8s-app: kubernetes-dashboard
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
spec:
  selector:
    k8s-app: kubernetes-dashboard
  ports:
  - port: 443
    targetPort: 8443

    -------------------------------------------------------------------------------------

dashboard]vi ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: dashboard.od.com
    http:
      paths:
      - backend:
          serviceName: kubernetes-dashboard
          servicePort: 443
-------------------------------------------------------------------------------------

#在其中一台运算节点运行
~]# kubectl apply -f http://k8s-yaml.cedarhd.com/dashboard/rbac.yaml
~]# kubectl apply -f http://k8s-yaml.cedarhd.com/dashboard/dp.yaml
~]# kubectl apply -f http://k8s-yaml.cedarhd.com/dashboard/svc.yaml
~]# kubectl apply -f http://k8s-yaml.cedarhd.com/dashboard/ingress.yaml

[root@test-nodes1 ~]# kubectl get pods -n kube-system
NAME                                    READY   STATUS    RESTARTS   AGE
coredns-6c69fbcc6c-6vqgr                1/1     Running   0          21h
kubernetes-dashboard-5d6f5f9cdd-plsjq   1/1     Running   0          20m
traefik-ingress-44ptk                   1/1     Running   0          4h5m
traefik-ingress-vrvr4                   1/1     Running   0          4h5m

[root@test-nodes1 ~]# kubectl get svc -n kube-system
NAME                      TYPE        CLUSTER-IP        EXTERNAL-IP   PORT(S)                  AGE
coredns                   ClusterIP   192.168.0.2       <none>        53/UDP,53/TCP,9153/TCP   21h
kubernetes-dashboard      ClusterIP   192.168.177.146   <none>        443/TCP                  20m
traefik-ingress-service   ClusterIP   192.168.254.186   <none>        80/TCP,8080/TCP          4h5m

[root@test-nodes1 ~]# kubectl get ingress -n kube-system
NAME                   HOSTS                        ADDRESS   PORTS   AGE
kubernetes-dashboard   test-dashboard.cedarhd.com             80      20m
traefik-web-ui         test-traefik.cedarhd.com               80      3h54m

kubernetes怎么安装部署Dashboard

看完这篇文章,你们学会kubernetes安装部署Dashboard的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI