部署dashboard
部署dashboard
1.編寫RBAC.yaml檔案
apiVersion: v1
kind: ServiceAccount
metadata:
name: nginx-sa
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: nginx-role
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: nginx-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: nginx-role
subjects:
- kind: ServiceAccount
name: nginx-sa
2.檢視secret
kubectl get secret
3.檢視對應的token
kubectl describe secret nginx-sa-token-775kt
4.定義dashboard.yaml
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Namespace
metadata:
name: kubernetes-dashboard
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
ports:
- port: 443
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-certs
namespace: kubernetes-dashboard
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-csrf
namespace: kubernetes-dashboard
type: Opaque
data:
csrf: ""
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-key-holder
namespace: kubernetes-dashboard
type: Opaque
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-settings
namespace: kubernetes-dashboard
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
rules:
# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
- apiGroups: [""]
resources: ["secrets"]
resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs", "kubernetes-dashboard-csrf"]
verbs: ["get", "update", "delete"]
# Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["kubernetes-dashboard-settings"]
verbs: ["get", "update"]
# Allow Dashboard to get metrics.
- apiGroups: [""]
resources: ["services"]
resourceNames: ["heapster", "dashboard-metrics-scraper"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:", "dashboard-metrics-scraper", "http:dashboard-metrics-scraper"]
verbs: ["get"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
rules:
# Allow Metrics Scraper to get metrics from the Metrics server
- apiGroups: ["metrics.k8s.io"]
resources: ["pods", "nodes"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kubernetes-dashboard
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
namespace: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubernetes-dashboard
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: kubernetes-dashboard
template:
metadata:
labels:
k8s-app: kubernetes-dashboard
spec:
containers:
- name: kubernetes-dashboard
image: kubernetesui/dashboard:v2.0.0-beta1
imagePullPolicy: Always
ports:
- containerPort: 8443
protocol: TCP
args:
- --auto-generate-certificates
- --namespace=kubernetes-dashboard
# Uncomment the following line to manually specify Kubernetes API server Host
# If not specified, Dashboard will attempt to auto discover the API server and connect
# to it. Uncomment only if the default does not work.
# - --apiserver-host=http://my-address:port
volumeMounts:
- name: kubernetes-dashboard-certs
mountPath: /certs
# Create on-disk volume to store exec logs
- mountPath: /tmp
name: tmp-volume
livenessProbe:
httpGet:
scheme: HTTPS
path: /
port: 8443
initialDelaySeconds: 30
timeoutSeconds: 30
volumes:
- name: kubernetes-dashboard-certs
secret:
secretName: kubernetes-dashboard-certs
- name: tmp-volume
emptyDir: {}
serviceAccountName: kubernetes-dashboard
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
---
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-metrics-scraper
name: dashboard-metrics-scraper
namespace: kubernetes-dashboard
spec:
ports:
- port: 8000
targetPort: 8000
selector:
k8s-app: kubernetes-metrics-scraper
---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
k8s-app: kubernetes-metrics-scraper
name: kubernetes-metrics-scraper
namespace: kubernetes-dashboard
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: kubernetes-metrics-scraper
template:
metadata:
labels:
k8s-app: kubernetes-metrics-scraper
spec:
containers:
- name: kubernetes-metrics-scraper
image: kubernetesui/metrics-scraper:v1.0.0
ports:
- containerPort: 8000
protocol: TCP
livenessProbe:
httpGet:
scheme: HTTP
path: /
port: 8000
initialDelaySeconds: 30
timeoutSeconds: 30
serviceAccountName: kubernetes-dashboard
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
5.應用yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
6.檢視當前已有的名稱空間
kubectl get namespace
7.檢視Service的type
kubectl get service --namespace=kubernetes-dashboard
8.將Service的type修改為NodePort
kubectl --namespace=kubernetes-dashboard edit service kubernetes-dashboard
9.訪問web dashboard
https://public_ip:32572
相關文章
- k8s dashboard部署K8S
- 容器編排系統K8s之Dashboard部署K8S
- 部署 K8s 圖形化管理工具 DashboardK8S
- idea 開啟 dashboardIdea
- Kubernetes Dashboard 安裝
- GitHub + wakatime => x- dashboardGithub
- 微服務探索之路02篇liunx ubuntu伺服器部署k8s(kubernetes)-kubernetes/dashboard微服務Ubuntu伺服器K8S
- K8S dashboard搭建部署,以及拒絕訪問,ImagePullBackOff,ErrImagePull,CrashLoopBackOff問題解決K8SOOP
- Node Exporter Grafana Dashboard 更新啦!ExportGrafana
- Kubernetes的Resource和Dashboard(十三)
- Idea開啟Run DashBoard配置Idea
- kubernetes之Ingress釋出Dashboard(二)
- kubernetes實戰篇之dashboard搭建
- 【k8s】在AWS EKS部署並通過ALB訪問k8s Dashboard保姆級教程K8S
- Sentinel Dashboard(基於1.8.1)流控規則持久化到Nacos——涉及部分Sentinel Dashboard原始碼改造持久化原始碼
- 微服務熔斷限流Hystrix之Dashboard微服務
- Hystrix-Dashboard儀表盤的使用
- springcloud(五):熔斷監控Hystrix DashboardSpringGCCloud
- k8s dashboard token 生成/獲取K8S
- apisix-dashboard上新增自定義外掛API
- Sentinel Dashboard中修改規則同步到Nacos
- 開源儀表盤-Dashboard-C#/WFC#
- 附004.Kubernetes Dashboard簡介及使用
- Grafana9的dashboard許可權問題Grafana
- neovim之DashBoard(neovim開始/啟動介面設定)
- 專業系統監視器:System Dashboard Pro for MacMac
- System Dashboard for Mac(Mac系統狀況檢測工具)Mac
- 報表工具能用來做 DashBoard 和大屏嗎?
- TheAdmin v1.0 – Responsive Bootstrap 4 Admin, Dashboard & WebApp TemplatebootWebAPP
- kubernetes實踐之十:Kubernetes-dashboard+Heapster+InfluxDB+GrafanaUXGrafana
- DevExpress v17.2新版亮點—Analytics Dashboard篇(二)devExpress
- DevExpress v17.2新版亮點—Analytics Dashboard篇(一)devExpress
- k8s建立普通使用者訪問dashboardK8S
- 登入 k8s-Dashboard 顯示 Your connection is not privateK8S
- 系統監測工具:System Dashboard Pro for Mac中文版Mac
- 系統儀表板:System Dashboard Pro mac直裝版Mac
- Swoole v4.8.0 版本釋出,增加 Swoole Dashboard 皮膚
- 微服務SpringCloud之熔斷監控Hystrix Dashboard和Turbine微服務SpringGCCloud