K8S----Dashboard
环境: K8s群集搭建完成
[root@master ~]# mkdir dashboard2
[root@master ~]# cd dashboard2
//上传dashboard的模块文件
[root@master dashboard]# rz -E
rz waiting to receive.
[root@master dashboard]# ls
dashboard-configmap.yaml dashboard-rbac.yaml k8s-admin.yaml
dashboard-controller.yaml dashboard-secret.yaml dashboard-service.yaml
//查看rbc 角色控制
[root@master dashboard2]# cat dashboard-rbac.yaml
kind: Role "资源类型:角色"
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: kubernetes-dashboard "资源标签"
addonmanager.kubernetes.io/mode: Reconcile
name: kubernetes-dashboard-minimal "资源名称"
namespace: kube-system "资源空间"
rules:
# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
- apiGroups: [""]
resources: ["secrets"]
resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs"]
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 from heapster.
- apiGroups: [""]
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding "资源类型,绑定角色"
metadata:
name: kubernetes-dashboard-minimal
namespace: kube-system
labels:
k8s-app: kubernetes-dashboard
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kubernetes-dashboard-minimal
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system
[root@master dashboard2]# cat dashboard-secret.yaml
apiVersion: v1
kind: Secret "资源类型为secret"
metadata:
labels:
k8s-app: kubernetes-dashboard
# Allows editing resource and makes sure it is created first.
addonmanager.kubernetes.io/mode: EnsureExists
name: kubernetes-dashboard-certs
namespace: kube-system
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
# Allows editing resource and makes sure it is created first.
addonmanager.kubernetes.io/mode: EnsureExists
name: kubernetes-dashboard-key-holder
namespace: kube-system
type: Opaque
[root@master dashboard2]# cat dashboard-controller.yaml
apiVersion: v1
kind: ServiceAccount "服务账户"
metadata:
labels:
k8s-app: kubernetes-dashboard
addonmanager.kubernetes.io/mode: Reconcile
name: kubernetes-dashboard
namespace: kube-system
---
apiVersion: apps/v1
kind: Deployment "无状态资源"
metadata:
name: kubernetes-dashboard "dashboard核心pod的名称"
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: "pod模板"
metadata:
labels:
k8s-app: kubernetes-dashboard
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec: "pod规格"
priorityClassName: system-cluster-critical
containers:
- name: kubernetes-dashboard
image: siriuszg/kubernetes-dashboard-amd64:v1.8.3
resources: "资源分配"
limits:
cpu: 100m "最大cpu0.1核"
memory: 300Mi "最大内存300M"
requests:
cpu: 50m "请求资源信息"
memory: 100Mi
ports:
- containerPort: 8443 ""
protocol: TCP
args:
# PLATFORM-SPECIFIC ARGS