k8s集群部署dashboard
程序员文章站
2022-03-11 22:53:18
...
基础环境
基本的K8S集群,可参考我的文章
部署步骤
-
dashboard-controller.yaml
apiVersion: extensions/v1beta1 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: serviceAccountName: dashboard containers: - name: kubernetes-dashboard image: kingdragon/kubernetes-dashboard-amd64:v1.6.3 resources: limits: cpu: 100m memory: 50Mi requests: cpu: 100m memory: 50Mi ports: - containerPort: 9090 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 tolerations: - key: "CriticalAddonsOnly" operator: "Exists"
补充:注意更改镜像仓库地址为你的镜像地址
-
dashboard-rbac.yaml
apiVersion: v1 kind: ServiceAccount metadata: name: dashboard namespace: kube-system --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: name: dashboard subjects: - kind: ServiceAccount name: dashboard namespace: kube-system roleRef: kind: ClusterRole name: cluster-admin apiGroup: rbac.authorization.k8s.io
补充:绑定的集群超级用户cluster-admin,按需求更改
-
dashboard-service.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: type: NodePort selector: k8s-app: kubernetes-dashboard ports: - port: 80 targetPort: 9090
补充:这里服务的暴露方式用的nodeport方式。还有其他模式,自行尝试。
-
执行所有文件
$ pwd /root/kubernetes/cluster/addons/dashboard $ ls *.yaml dashboard-controller.yaml dashboard-service.yaml dashboard-rbac.yaml $ kubectl create -f . service "kubernetes-dashboard" created deployment "kubernetes-dashboard" created clusterrolebinding.rbac.authorization.k8s.io/dashboard created
-
查看执行结果
$ kubectl get services kubernetes-dashboard -n kube-system NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-dashboard 10.254.224.130 <nodes> 80:30312/TCP 25s
-
访问dashboard
访问nodeip:30312
上一篇: android输入字符限制
下一篇: Centos7 初始化脚本
推荐阅读
-
.net core i上 K8S(一)集群搭建
-
Spring Cloud Alibaba | Nacos集群部署
-
Mysql基于Mysql Cluster+MysqlRouter的集群部署方案
-
laravel项目利用twemproxy部署redis集群的完整步骤
-
通过Docker部署Redis 6.x集群的方法
-
使用docker快速部署Elasticsearch集群的方法
-
使用Kubeadm在CentOS7.2上部署Kubernetes集群的方法
-
Nginx部署tomcat/wildfly集群负载均衡
-
使用Ruby脚本部署Redis Cluster集群步骤讲解
-
在 Kubernetes 集群快速部署 KubeSphere 容器平台