GitHub下載地址
公司主營業(yè)務:成都做網站、網站建設、移動網站開發(fā)等業(yè)務。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)建站是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)建站推出古藺免費做網站回饋大家。
在master01服務器操作
[root@master01 ~]# mkdir abc //創(chuàng)建掛載目錄
[root@master01 ~]# mount.cifs //192.168.80.2/Shares/K8S/k8s03 /root/abc/ //將準備好的yaml文件掛載到abc目錄
Password for root@//192.168.80.2/Shares/K8S/k8s03:
[root@master01 ~]# cd abc/
[root@master01 abc]# ls
dashboard-configmap.yaml dashboard-rbac.yaml dashboard-service.yaml
dashboard-controller.yaml dashboard-secret.yaml k8s-admin.yaml
[root@master01 abc]# cd /root/k8s/
[root@master01 k8s]# mkdir dashboard //創(chuàng)建工作目錄
[root@master01 dashboard]# cp /root/abc/*.yaml /root/k8s/dashboard/ //將文件拷貝到工作目錄
[root@master01 dashboard]# ls
dashboard-configmap.yaml dashboard-rbac.yaml dashboard-service.yaml
dashboard-controller.yaml dashboard-secret.yaml k8s-admin.yaml
[root@master01 dashboard]# kubectl create -f dashboard-rbac.yaml
role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
[root@master01 dashboard]# kubectl create -f dashboard-secret.yaml
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-key-holder created
[root@master01 dashboard]# kubectl create -f dashboard-configmap.yaml
configmap/kubernetes-dashboard-settings created
[root@master01 dashboard]# kubectl create -f dashboard-controller.yaml
serviceaccount/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
[root@master01 dashboard]# kubectl create -f dashboard-service.yaml
service/kubernetes-dashboard created
[root@master01 dashboard]# kubectl get pods -n kube-system //完成后查看創(chuàng)建在指定的kube-system命名空間下
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-65f974f565-72cs2 0/1 ContainerCreating 0 3m42s
[root@master01 dashboard]# kubectl get pods,svc -n kube-system //查看如何訪問
NAME READY STATUS RESTARTS AGE
pod/kubernetes-dashboard-65f974f565-72cs2 1/1 Running 1 25m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes-dashboard NodePort 10.0.0.89 443:30001/TCP 23m
回到master01服務器操作
[root@master01 dashboard]# vim dashboard-cert.sh //創(chuàng)建證書文件
cat > dashboard-csr.json <
回到master01節(jié)點服務器操作生成令牌
[root@master01 dashboard]# kubectl create -f k8s-admin.yaml //指定文件方式創(chuàng)建令牌
serviceaccount/dashboard-admin created
clusterrolebinding.rbac.authorization.k8s.io/dashboard-admin created
[root@master01 dashboard]# kubectl get secret -n kube-system //保存令牌
NAME TYPE DATA AGE
dashboard-admin-token-2slr4 kubernetes.io/service-account-token 3 44s
default-token-g6klk kubernetes.io/service-account-token 3 26h
kubernetes-dashboard-certs Opaque 11 124m
kubernetes-dashboard-key-holder Opaque 2 160m
kubernetes-dashboard-token-42q89 kubernetes.io/service-account-token 3 159m
[root@master01 dashboard]# kubectl describe secret dashboard-admin-token-2slr4 -n kube-system //查看剛保存的dashboard-admin-token-2slr4令牌文件,
Name: dashboard-admin-token-2slr4
Namespace: kube-system
Labels:
Annotations: kubernetes.io/service-account.name: dashboard-admin
kubernetes.io/service-account.uid: 3f7a81ec-4d5c-11ea-8ed9-000c297d4201
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1359 bytes
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tMnNscjQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiM2Y3YTgxZWMtNGQ1Yy0xMWVhLThlZDktMDAwYzI5N2Q0MjAxIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.db1SgMq37OagIsRiPMgR-zWpneHpzTVGun3Di4VYdVY1XBmmD_DraAGElLal6fm7t5nMVwIqOI3SH2w_0B8iZbHYJUwowMjW6GSSg_W4SP0E4Dfec29MhyIX8NMRRIWqJKRsf9vTj5F5Drjs1PSBAYLOWPibNVp81KzyzvIdHVW_o8x7apYz_uU7GxvvYasEtY5xjJIbzs9BjHfWE2vEPDm04B6Gs9x_dHw89o2izYQwisKpaiqepWyMP6uHj6gZk9ksvzg7bz_t5NpEczJmoZNNjXhkjLyZ8k2Y_3Zl0N5T55i5SPXIae46wt-G-Q7ezuYWJjL5EP-wR7gEuE7IyA