Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Kubernetes configuration Management Dashboard (XIII)

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

All the operations of Kubernetes are done through the command line tool kubectl. In order to provide a richer user experience, Kubernetes has also developed a Web-based Dashboard, which allows users to deploy containerized applications, monitor the status of applications, perform troubleshooting tasks and manage Kubernetes resources with Kubernetes Dashboard.

In Kubernetes Dashboard, you can view the running status of applications in the cluster, and you can also create and modify various Kubernetes resources, such as Deployment, Job, DaemonSet, and so on. Users can Scale Up/Down Deployment, execute Rolling Update, restart a Pod, or deploy a new application through a wizard. Dashboard can display the status and log information of various resources in the cluster.

It can be said that Kubernetes Dashboard provides most of the functions of kubectl, and you can choose according to the situation.

Install and configure 1.1 download image

Because the image of kubernetes-dashboard is inaccessible to our mainland, we still obtain it indirectly. You can check the specific version by error.

Docker pull registry.cn-shanghai.aliyuncs.com/qubit/kubernetes-dashboard-amd64:v1.10.0docker tag registry.cn-shanghai.aliyuncs.com/qubit/kubernetes-dashboard-amd64:v1.10.0 k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0docker image rm registry.cn-shanghai.aliyuncs.com/qubit/kubernetes-dashboard-amd64:v1.10.01.2, installation

Kubernetes does not deploy Dashboard by default. You can install it with the following command:

Kubectl create-f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml

Dashboard creates its own Deployment and Service in kube-system namespace.

1.3.Modification of NodePort

Because Service is of type ClusterIP, we can change it to type NodePort with the following command for convenience.

Kubectl patch svc kubernetes-dashboard-p'{"spec": {"type": "NodePort"}'- n kube-system

View Port

[root@master ~] # kubectl get svc-n kube-systemNAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGEkube-dns ClusterIP 10.96.0.10 53 Universe 6hkubernetes-dashboard NodePort 10.107.238.193 443:30931/TCP 167m 2, configuration authorization

Visit the address https://10.0.0.23:30931, remember to use Firefox or Google browser, some domestic browsers may have problems.

Dashboard supports both Kubeconfig and Token authentication. In order to simplify the configuration, we grant admin permission to the default user of Dashboard through the configuration file dashboard-admin.yaml.

ApiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: name: admin-userroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-adminsubjects:- kind: ServiceAccount name: admin-user namespace: kube-system---apiVersion: v1kind: ServiceAccountmetadata: name: admin-user namespace: kube-system

Apply and get the token.

Kubectl apply-f dashboard-admin.yamlkubectl-n kube-system describe secret $(kubectl-n kube-system get secret | grep admin-user | awk'{print $1}')

Similar to the following paragraph, just fill in the token to confirm.

Name: admin-user-token-xln5dNamespace: kube-systemLabels: Annotations: kubernetes.io/service-account.name: admin-user kubernetes.io/service-account.uid: 54801c01-01e2-11e9-857e-00505689640fType: kubernetes.io/service-account-tokenData====ca.crt: 1025 bytesnamespace: 11 bytestoken: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXhsbjVkIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1NDgwMWMwMS0wMWUyLTExZTktODU3ZS0wMDUwNTY4OTY0MGYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.MbGeROnjA9f1AhBO8v2GuHC1ihVk1UcxpM8lYkIC_P9Mx9jVZcM56zr4jcxjSnIuZPZxIznLJIIo7TRY94Ya2VujzF2lpDxlNYF2hWY3Ss9d5LqRtP3JsJNZVLmxvYIGnmnGyVCEikCM6W44WPu-Sm71TKwCOFImF7wz7pu4atJH-xrEedO7agQaGK8A_EYrE_gfGCFuMXWtz6Oj94t0InXo7hDnFl1xMI0f3cA0WYJKhzh0Gmm2MTEJXKedvjspLUGuDSY-AjI2VGIfccafpcYKHyXNO_2j4Lf4cF3Zv7TdHG3DCWVKNox4QSEgv7HJMprwlVRKpliKe4m4YY4MQg

Official document: https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report