ASP.NET Core on K8S depth study (7) Dashboard Know

Benpian has joined " the .NET Core ON K8S study and practice series index ", you can click to see more container technology related series of articles.

In the second " Deployment Process Analysis and Dashboard " describes how to deploy Dashboard, but no more how to use the Dashboard, paper to use Dashboard supplement.

First, on K8S Dashboard

  K8S Dashboard is an official of the Web-based user interface, designed to manage the K8S cluster, and can show the status of the cluster, perform a variety of resource management K8S of troubleshooting that is.

  

  K8S Dashboard provides  kubectl most of the functionality, we can choose according to the situation.

  After K8S cluster installed by default does not contain the Dashboard, we need to create it extra.

Second, the installation and configuration Dashboard

2.1 Installation Dashboard

  Please refer to my previous article " ASP.NET Core ON K8S depth study (2) the deployment process analysis and Dashboard " to install Dashboard deployed a text, not repeat them here.

2.2 Configuration Dashboard

  Dashboard support kubeconfig and token authentication modes, by default every time or need to refresh kubeconfig get token. Therefore, in order to simplify the configuration, we can modify the configuration file for the default permissions granted to admin Dashboard users.

  Profile dashboard-admin.yaml follows:

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: kubernetes-dashboard
  labels: 
     k8s-app: kubernetes-dashboard
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard
  namespace: kube-system

  Then bring it into force by kubectl apply:

kubectl apply -f dashboard-admin.yaml

  

   Now, we re-enter the Dashboard login screen, you can choose to enter the Skip button to skip the authentication Dashboard main interface.

  

2.3 Dashboard interface

  (1) navigation area

  Dashboard navigation menu to the left part of the area, you can view and manage the various resources in the cluster by the navigation menu:

  ① Cluster-level resources

  

  ② Namespace level resources

  

  (2) the body region

  在导航菜单中选中了具体的某类资源,中间主题区就会显示该资源所有的示例。下图就是选择容器组(Pods)后的主体区域内容:

  

三、Dashboard的使用场景

3.1 快速部署应用

  Dashboard右上角点击创建按钮:

  

   会弹出以下界面:

  

  可以看到,我们可以直接在Web界面中输入我们要部署的应用的一些信息,比如输入名字,选择镜像,设置副本数等等等等。

  不过,还是建议通过上传YAML配置文件的方式进行部署:

  

   通过YAML配置文件上传的话,可以部署Deployment、DaemonSet、Job等各种类型的资源,并且足够快速。下图是点击上传之后跳转到具体Deployment之后的效果:

  

3.2 在线操作具体资源

  对于K8S的各种资源,我们都可以通过单击按钮执行各种操作,如下图所示:

  

   可以看出,我们可以对刚刚上传的Deployment进行伸缩(Scale Up)、删除以及查看/编辑YAML配置文件。

  (1)伸缩

  例如刚刚上传的YAML配置文件中副本数定义为2,这时我们想要增加一个副本到3:

  

  (2)查看/编辑YAML配置文件

  如果想要进行更多的配置修改,可以直接点击查看/编辑YAML进行修改,修改之后点击更新即可快速应用新配置:

  

3.3 查看资源详情

  如果想对某个资源查看其详细信息,比如Labels、Strategy、Selector等等,就像我们之前使用kubectl describe一样,那我们只需要点击某个资源就可以跳转详情页查看。这里比如我们点击刚刚上传的Deployment:

  

3.4 在线查看Pod日志

  在容器组(Pods)页面选择某个具体的Pod单击按钮,即可查看Pod的日志,与我们输入kubectl logs效果一样。

   

   

四、小结

  本文介绍了K8S Dashboard的安装和使用,基于K8S Dashboard我们可以完成日常管理的大部分工作,可以作为命令行工具kubectl的补充。当然,本文介绍的Dashboard的使用只是一些最典型的场景,还有很多的实用功能需要我们去探索和发现。

参考资料

(1)CloudMan,《每天5分钟玩转Kubernetes

(2)李振良,《一天入门Kubernets教程

(3)马哥(马永亮),《Kubernetes快速入门

 

Guess you like

Origin www.cnblogs.com/edisonchou/p/aspnet_core_on_k8s_deepstudy_part7.html