Kubernetes uses Weave Scope to monitor clusters

Creating a kubernetes cluster and deploying containerized applications is only the first step. Once the cluster is in place, we need to ensure that all the components work together and meet their needs. Kubernetes is a complex system. The operation and maintenance team needs a set of tools to help them know the real-time status of the cluster and provide timely and accurate data support for troubleshooting.

1, Installation

Weave Scope is a visual monitoring tool for Docker and Kubernetes. Scope provides a complete view of cluster infrastructure and applications from top to bottom. Users can easily monitor and diagnose distributed container applications in real time.
The method of installing Scope in K8s cluster is very simple. Use the following command:

[root@master ~]# kubectl apply -f "https://cloud.weave.works/k8s/scope.yaml?k8s-version=$(kubectl version | base64 | tr -d '\n')&k8s-service-type=NodePort"
namespace/weave created
serviceaccount/weave-scope created
clusterrole.rbac.authorization.k8s.io/weave-scope created
clusterrolebinding.rbac.authorization.k8s.io/weave-scope created
deployment.apps/weave-scope-app created
service/weave-scope-app created
daemonset.extensions/weave-scope-agent created

After successful deployment, there are the following related components:

[root@master ~]# kubectl get pod -n weave
NAME                               READY   STATUS    RESTARTS   AGE
weave-scope-agent-6l4wn            1/1     Running   0          4m55s
weave-scope-agent-dfpdl            1/1     Running   0          4m55s
weave-scope-agent-spxb4            1/1     Running   0          4m55s
weave-scope-app-6979884cc6-hpkdz   1/1     Running   0          4m55s
[root@master ~]# kubectl get svc -n weave
NAME              TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
weave-scope-app   NodePort   <none>        80:30229/TCP   5m
[root@master ~]# kubectl get deploy -n weave
weave-scope-app   1/1     1            1           5m13s
  1. Daemon set weave scope agent is a scope agent program that runs on each node of the cluster and is responsible for collecting data.
  2. Deployment weave scope app, scope application, obtains data from agent, displays it through Web UI and interacts with users.
  3. Service # weave scope app, the default is ClusterIP type. We have added the parameter k8s service type = NodePort in the above command and changed it to NodePort.

2, Using Scope

Browser access http://YOUR_MASTER_IP:30229/´╝îScope All current controllers (Deployment, DaemonSet, etc.) are displayed by default.

2.1 topology

Scope will automatically build the logical topology of applications and clusters. For example, click "Pods" at the top to display all Pods and their dependencies.

Click Hosts to display the relationship between nodes. You can view the CPU and memory usage of resources in Scope.

2.2 online operation

Scope also provides convenient online operation functions, such as selecting a Host and clicking & gt_ Button can directly open the command line terminal of the node in the browser:

Click + in Deployment to perform Scale Up:

You can view the log of Pod:

You can attach, restart, stop containers, and troubleshoot problems directly in Scope:

2.3. Powerful search function

Scope supports keyword search and locating resources.

You can also perform conditional searches, such as finding and locating pods with memory > 100m.

The Weave Scope interface is extremely friendly and the operation is simple and smooth. More functions are left for you to explore.

Official documents: https://www.weave.works/docs/scope/latest/installing/#k8s

Tags: Kubernetes

Posted by JH5 on Tue, 17 May 2022 15:53:28 +0300