Use Weave Scope to monitor Docker containers and Kubernetes

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Weave Scope is a monitoring tool for Docker and Kubernetes clusters. It allows you to monitor local Docker hosts and Kubernetes clusters in real time.

You can visualize the utilization of containers or clusters on the web dashboard.

Weave Scope can also be used to manage docker containers, including operations such as starting and stopping the container. You can also access the container shell from Weave Scope.

This guide will introduce how to install Weave Scope on the local Docker host and Kubernetes cluster.

Install Weave Scope on the Docker host

Run the following command on the Docker host to install Weave Scope:

sudo curl -L git.io/scope -o /usr/local/bin/scope
sudo chmod a+x /usr/local/bin/scope

Start organization scope:

$ scope launch

Sample output:

# scope launch
7807556aed11a523d5ec2dc651a438aa6bae7df1a2d76dd440c82530b475c49d
Scope probe started
Weave Scope is listening at the following URL(s):
  * http://172.16.34.12:4040/

You can now http://server-IP:4040

The dashboard will show the containers running on the host, and there are several other options for managing and/or monitoring the host:

To manage your containers, click on one of them, and you will see an interface where you can view the indicators of the container, and you can also perform various operations on the container, such as start, stop, pause, etc. You can also execute the shell of the container as shown below:

Use weaving scope to monitor and manage Docker

Regular indicators can be found in table label:

Use weaving scope to manage Docker containers

Install Weave Scope on the Kubernetes cluster

We will deploy Weave Scope on the K8s cluster and demonstrate how to use the tool to monitor and manage your cluster.

Weave Scope service will be exposed through NodePort in this tutorial.but Do not It is recommended to expose the Weave Scope service to the Internet, as this will make your cluster vulnerable to attacks by anyone who can access it.

This means that services should only be exposed when running on the local network.

Use the following script to deploy Weave Scope:

kubectl apply -f 'https://cloud.weave.works/launch/k8s/weavescope.yaml?k8s-service-type=NodePort'

Sample output:

namespace/weave configured
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
deployment.apps/weave-scope-cluster-agent created
daemonset.apps/weave-scope-agent created

This will deploy 2 Pods, Weave-scope-app and Weave-scope-agent. Weave-scope-agent runs on each node.

Deployment is also limited to Weave Namespaces.

To see if the deployment has started successfully:

$ kubectl get pods -n weave
NAME                                         READY   STATUS    RESTARTS   AGE
weave-scope-agent-btpg7                      1/1     Running   0          3h20m
weave-scope-agent-qmvtx                      1/1     Running   0          3h20m
weave-scope-app-545ddf96b4-bvmbj             1/1     Running   0          3h20m
weave-scope-cluster-agent-74c596c6b7-wnj9r   1/1     Running   0          3h20m

Then, we need to use the following command to get the exposed NodePort:

$ kubectl get service -n weave
NAME              TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
weave-scope-app   NodePort   10.111.239.55   <none>        80:32766/TCP   3h25m

In the above example, the weave-scope-app service has been exposed on port 32766 using the NodePort service type.

Now, we can access the dashboard through the controller IP and NodePort.

Weaving scope kubernetes dashboard

In the above figure, we can visualize the Kubernetes cluster and manage it.

You can check the logs of different deployments from the dashboard.

Weaving range k8s pod log

From the dashboard, we can also check the health and status of the container.

Weaving range kubernetes log

in conclusion

Weave Scope is easy to install and use. It has some interesting features that you want to explore as a system administrator.

Check out the following other interesting tools on our website:

How to install Netdata on Kubernetes using Helm

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Sidebar