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

Web interface (Dashboard) of K8s from installation to application

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Web interface (Dashboard)

Everything previously done in kubernetes is done through the command line tool kubectl, and to provide a richer user experience, kubernetes has also developed a web-based user interface (Dashboard). Users can use Dashboard to deploy containerized applications, monitor the status of applications, perform troubleshooting, and manage various resources in kubernetes.

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, etc.). Users can auto-scale Deployment, perform rolling upgrades, restart pod, or use wizards to create new applications.

It can be said that kubernetes Dashboard provides most of the functions of kubectl.

Dashboard also shows the resource status information and all error messages in the kubernetes cluster.

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

Download address of GitHub project: https://github.com/kubernetes/dashboard

First, deploy Dashboard UI

Kubernetes does not deploy Dashboard by default, which can be downloaded with the following command:

# download the yaml file locally: [root@master dashboard] # wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.0/src/deploy/recommended/kubernetes-dashboard.yaml

# modify yaml file:

As the download address specified in the yaml file is a foreign image by default, due to the limitations of the domestic network environment, we download it through Ali Cloud Mirror Station.

Because service is a ClusterIP type, in order to make external applications easy to use, it is modified to NodePort type.

# # after saving and exiting, execute kubectl apply-f to create dashboard:

# # View the status of pod and service (dashboard creates its own pod and service in the kube-system command space): [root@master dashboard] # kubectl get pod-n kube-system | grep dashboardkubernetes-dashboard-6cfb7d8f54-rp9nd 1 + 1 Running 0 2m23s [root@master dashboard] # kubectl get svc-n kube-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGEkube-dns ClusterIP 10.96.0.10 53/UDP 53max TCP 94dkubernetes-dashboard NodePort 9153Compact 443:32134/TCP 3m8s# 10.108.35.182 TCP has already assigned port 32134 to service at this time Note that it is port 443 (https) two, access Dashboard UI

Access the URL through Firefox: the interface after entering https://172.16.1.30:32134/ is as follows:

You can see that Dashboard supports both kubeconfig and Token authentication. This article uses Token to log in. For more information on kubeconfig login, please see the document: http://note.youdao.com/noteshare?id=b0523244024d563cdc1bf7c8f7d6083c&sub=A8921821A7BE4CE4BC36B1DC86966460.

Log in via Token:

1) create a dashboard management user: [root@master dashboard] # kubectl create serviceaccount dashboard-admin-n kube-system serviceaccount/dashboard-admin created2) bind the user to the cluster management user: [root@master dashboard] # kubectl create clusterrolebinding dashboard-cluster-admin-- clusterrole=cluster-admin-- serviceaccount=kube-system:dashboard-adminclusterrolebinding.rbac.authorization.k8s.io/dashboard-cluster-admin created3) get the user's Token: [root@master dashboard] # kubectl get secrets-n kube-system | grep dashboard -admindashboard-admin-token-4gdsc kubernetes.io/service-account-token 3 4m17s4) View the details of the token: [root@master dashboard] # kubectl describe secrets-n kube-system dashboard-admin-token-4gdsc

# # copy the acquired Token to the Token input box in the login interface:

# # the web interface after a successful login is as follows:

Third, use Dashboard

1Dashboard interface structure

The interface of Dashboard is very simple, divided into three large areas:

1) Top operation area: here users can search for resources in the cluster, create resources, or exit.

2) left navigation menu: you can view and manage various resources in the cluster through the navigation menu. Menu items are divided into two categories according to the level of resources:

Cluster-level resources:

NameSpace-level resources:

The NameSpace of default is displayed by default, and you can switch according to the corresponding Namespace.

3) Intermediate subject area: if you click on a resource in the navigation menu, all instances of that resource will be displayed in the intermediate host area, such as clicking on the service resource

2, typical usage scenarios

Let's practice several typical usage scenarios of Dashboard:

1. Deploy Deployment:

1) Click the + CREATE button in the top operation area:

Users can directly enter the name, image, number of copies and other information of the application to be deployed; users can also YAML configuration files. If uploading YAML files, they can create any type of resources, not just Deployment.

2. Operate resources online:

For each resource, the user can click the drop-down menu on the right to perform various actions (delete, view, edit, etc.)

# # for example, click View/edit YAML to modify the configuration of the resource directly, and take effect immediately after saving it. The effect is the same as kubectl edit.

3. View the details of the resource

Click on the name of a resource instance to view the details, which is the same as kubectl describe.

4. View the Pod log

Click the "LOGS" button at the top of the Pod or parent resource (DaemonSet,ReplicaSet, etc.) page to view the log of Pod (the viewer can view the log of different containers of the same pod), which is the same as executing kubectl logs on the command line.

Summary:

The above is the installation and use of kubernetes Dashboard. Dashboard can do most of the work of daily management and can be used as a supplement to the command line tool kubectl.

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