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

Deployment and use of Dashboard for K8s

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

Share

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

In the previous section, we did all the operations of Kubernetes 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.

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/src/deploy/recommended/kubernetes-dashboard.yaml

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

[root@k8s-master] # kubectl get deployments. -n kube-system kubernetes-dashboard- o wideNAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTORkubernetes-dashboard 1max 1 120 m kubernetes-dashboard k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1 k8s-app=kubernetes-dashboard [root@k8s-master ~] # kubectl Get service-n kube-system kubernetes-dashboard NAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGEkubernetes-dashboard ClusterIP 10.108.187.212 443/TCP 22m

Because Service is of ClusterIP type, we can change it to NodePort type through kubectl-- namespace=kube-system edit service kubernetes-dashboard for convenience.

Spec: clusterIP: 10.108.187.212 externalTrafficPolicy: Cluster ports:-nodePort: 30338 port: 443protocol: TCP targetPort: 8443 selector: k8s-app: kubernetes-dashboard sessionAffinity: None type: NodePortstatus: loadBalancer: {}

Save the changes and port 30338 has been assigned to Service.

[root@k8s-master] # kubectl get service-n kube-system kubernetes-dashboard NAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGEkubernetes-dashboard NodePort 10.108.187.212 443:30338/TCP 28m

To access Dashboard https://192.168.31.200:30338/ through a browser, the login interface is as follows:

Configure login permissions

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.

Execute kubectl apply to make it effective.

Now click the SKIP on the login page directly to enter the Dashboard.

The use of Dashboard

Dashboard interface structure

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

Top operating area

Here users can search for resources in the cluster, create resources, or exit.

Left navigation menu

Various resources in the cluster can be viewed and managed through the navigation menu. Menu items are divided into two categories according to the hierarchy of resources:

Cluster-level resources

Namespace-level resources

Default Namespace is displayed by default, which can be toggled:

Intermediate main body area

If you click on a resource in the navigation menu, all instances of that resource will be displayed in the middle body area, such as clicking Pods.

Typical usage scenario

Next, let's introduce several typical usage scenarios of Dashboard.

Deploy Deployment

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, or upload YAML configuration files. If you are uploading a configuration file, you can create any type of resource, not just Deployment.

Online operation

For each resource, you can click the button to perform a variety of actions.

For example, you can directly modify the configuration of resources by clicking View/edit YAML, which takes effect immediately after saving. The effect is the same as that of kubectl edit.

View resource details

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

View Pod Log

Click the button on the page of Pod and its parent resources (DaemonSet, ReplicaSet, etc.) to view the log of Pod, which has the same effect as kubectl logs.

Kubernetes Dashboard has a friendly interface and strong self-explanation, so it can be regarded as the GUI version of kubectl.

Summary

This chapter describes 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