Weave Scope is a monitoring tool for Docker and Kubernetes clusters. It allows you to monitor your on-premise Docker host as well as Kubernetes cluster in realtime.

You can visualize the utilization of your containers or your cluster on a web dashboard.

Weave Scope can also be used to manage your docker containers which includes operations such as start,stop containers. You can also access the container shell from Weave Scope.

This guide shall cover how to install Weave Scope on an on-premise Docker host and on a Kubernetes cluster.

Install Weave Scope on Docker host

Run the following commands on a 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

Launch Weave 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 access Weave scope on http://server-IP:4040

The dashboard will show the containers running on your host and there are several other options to manage and/or monitor your host:

weavescope docker containers

To manage your containers, click one one of them, you will be presented with an interface where you can view the metrics of the container and also do various operations on the container such as start,stop, pause etc. You can also execute the container’s shell as shown below:

monitor and manage docker using weave scope

General metrics are available at the Table tab:

manage docker containers with weave scope

Install Weave Scope on Kubernetes Cluster

We shall deploy Weave Scope on our K8s cluster and demonstrate how to monitor and manage your cluster using the tool.

Weave Scope service will be exposed via NodePort in this tutorial. It is however NOT advisable to expose Weave Scope service to the internet as this will leave your cluster vulnerable to anyone who can access it.

This means that you should only expose the service if you are running on a local network.

Deploy Weave Scope using the script below:

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 deploys 2 pods,Weave-scope-app and Weave-scope-agent. The Weave-scope-agent runs on every node.

The deployment is also confined in weave namespace.

To see if the deployments have 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

We then need to obtain the NodePort that has been exposed using the command below:

$ 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 sample above, the weave-scope-app service has been exposed on port 32766 using NodePort service-type.

We can now access the dashboard through the controller IP and the NodePort.

weave scope kubernetes dashboard

In the image above, we can visualize our Kubernetes cluster and also manage it.

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

weave scope k8s pod logs

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

weave scope kubernetes logs

Conclusion

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

Check out these other interesting tools on our site:

How To Install Netdata on Kubernetes using Helm

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here