kubernetes怎么安裝部署Dashboard?相信大部分人都還不知道怎么安裝部署,為了讓大家學會,給大家總結(jié)了以下內(nèi)容。
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設,白銀企業(yè)網(wǎng)站建設,白銀品牌網(wǎng)站建設,網(wǎng)站定制,白銀網(wǎng)站建設報價,網(wǎng)絡營銷,網(wǎng)絡優(yōu)化,白銀網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。#在運維主機上運行
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/
#創(chuàng)建四個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
-------------------------------------------------------------------------------------
#在其中一臺運算節(jié)點運行
~]# 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 53/UDP,53/TCP,9153/TCP 21h
kubernetes-dashboard ClusterIP 192.168.177.146 443/TCP 20m
traefik-ingress-service ClusterIP 192.168.254.186 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的方法了嗎?如果還想學到更多技能或想了解更多相關內(nèi)容,歡迎關注創(chuàng)新互聯(lián)網(wǎng)站建設公司行業(yè)資訊頻道,感謝各位的閱讀!
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)建站www.cdcxhl.com,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。