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:

Monitor Docker Containers and Kubernetes using Weave Scope Cloud Containers How To Kubernetes Linux Tutorials Monitoring

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 Docker Containers and Kubernetes using Weave Scope Cloud Containers How To Kubernetes Linux Tutorials Monitoring

General metrics are available at the Table tab:

Monitor Docker Containers and Kubernetes using Weave Scope Cloud Containers How To Kubernetes Linux Tutorials Monitoring

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           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.

Monitor Docker Containers and Kubernetes using Weave Scope Cloud Containers How To Kubernetes Linux Tutorials Monitoring

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.

Monitor Docker Containers and Kubernetes using Weave Scope Cloud Containers How To Kubernetes Linux Tutorials Monitoring

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

Monitor Docker Containers and Kubernetes using Weave Scope Cloud Containers How To Kubernetes Linux Tutorials Monitoring

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