kubernetes1.24从构建到躺平「七」

kubernetes1.24从构建到躺平「七」OS: Ubuntu Server 22.04 LTS1) 生成DashBoardroot@srv1:~# kubectl apply -f k

欢迎大家来到IT世界,在知识的湖畔探索吧!

OS: Ubuntu Server 22.04 LTS

1) 生成DashBoard

root@srv1:~# kubectl apply -f kubernetes-dashboard.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created

欢迎大家来到IT世界,在知识的湖畔探索吧!

2) 确认状态

欢迎大家来到IT世界,在知识的湖畔探索吧!root@srv1:~# kubectl  get pods -n kubernetes-dashboard -o wide
NAME                                        READY   STATUS    RESTARTS   AGE     IP                          NODE               NOMINATED NODE   READINESS GATES
dashboard-metrics-scraper-8c47d4b5d-gt4mg   1/1     Running   0          74m   10.244.2.7          srv2.1000y.cloud   <none>           <none>
kubernetes-dashboard-5676d8b865-92g2q       1/1     Running   0          74m   10.244.1.6           srv2.1000y.cloud   <none>           <none>

3) 添加一个DashBoard管理帐户

root@srv1:~# kubectl create serviceaccount kube-dashboard-admin-sa -n kube-system
serviceaccount/kube-dashboard-admin-sa created

4) 赋权

欢迎大家来到IT世界,在知识的湖畔探索吧!root@srv1:~# kubectl create clusterrolebinding kube-dashboard-admin-sa --clusterrole=cluster-admin --serviceaccount=kube-system:kube-dashboard-admin-sa
clusterrolebinding.rbac.authorization.k8s.io/kube-dashboard-admin-sa created

5) 获取token

root@srv1:~# kubectl create token kube-dashboard-admin-sa -n kube-system --duration=87600h
eyJhbGciOiJSUzI1NiIsImtpZCI6IkJJY3RSbEhNM21udHQ3dUNzcThPUGJOMVI2bWFKOFk3YUFWUFEwZ1E0ZlUifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdW
Jlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxOTcxMjUwOTc0LCJpYXQiOjE2NTU4OTA5NzQsImlzcyI6Imh0dHBzOi8va3V
iZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsInNlcnZpY2Vh
Y2NvdW50Ijp7Im5hbWUiOiJrdWJlLWRhc2hib2FyZC1hZG1pbi1zYSIsInVpZCI6ImE1ZjIwNDBiLTA5ZmItNDM5OS04YjQ5LTg1ZDlhY2VjYzc5ZiJ9f
SwibmJmIjoxNjU1ODkwOTc0LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZS1kYXNoYm9hcmQtYWRtaW4tc2EifQ.u7V
59r97i6rKs6rErkKZkYeVhpmDRdyMXFcr8QtWeCZa7N9neiXUO6G9xpamPao5iPkrwiTEmKnzAfjTCi5QLiM-lJgQ_oT77b3AehYNA0RPCfYpIFhyZ043
4Jy_jJt7WwJymhnAphmPumfPxiXc71l6fypR45GEjnYkdMVu-PhAgL4BwNLZpply2p6v_RTvIyxOgezY6J9JlHYyM7zynsZ17kH_MxX_k2pKJr4xWqIy7
68NBKiDfTnPr4TY94gwD3ZM_SoscMwN_HXXFbHVGOkc4RefIK-rqMkfgcMGGrTNihEWexEnsTKmJdwH0rTTx_4buy7PKGJ5TXd8gzgvsA

6) 暴露DashBoard端口

root@srv1:~# kubectl get svc -n kubernetes-dashboard -o wide
NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE   SELECTOR
dashboard-metrics-scraper   ClusterIP   10.106.116.226   <none>        8000/TCP   89m   k8s-app=dashboard-metrics-scraper
kubernetes-dashboard        ClusterIP   10.109.189.62    <none>        443/TCP    89m   k8s-app=kubernetes-dashboard

root@srv1:~# kubectl patch svc -n kubernetes-dashboard kubernetes-dashboard -p '{"spec": {"type" : "NodePort"}}'
service/kubernetes-dashboard patched

root@srv1:~# kubectl get svc -n kubernetes-dashboard -o wide
NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE   SELECTOR
dashboard-metrics-scraper   ClusterIP   10.106.116.226   <none>        8000/TCP        96m   k8s-app=dashboard-metrics-scraper
kubernetes-dashboard        NodePort    10.109.189.62    <none>        443:30125/TCP   96m   k8s-app=kubernetes-dashboard

7) 访问DashBoard

[浏览器]==>[https://srv1.1000y.cloud:30125]

kubernetes1.24从构建到躺平「七」

输入Token

kubernetes1.24从构建到躺平「七」

Kubernetes DashBoard展现

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://itzsg.com/34954.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

联系我们YX

mu99908888

在线咨询: 微信交谈

邮件:itzsgw@126.com

工作时间:时刻准备着!

关注微信