Troubleshooting Containers in Kubernetes With Weave Scope & Weave Cloud
Weave Scope is an open-source container visualization and troubleshooting project from Weaveworks that gives you a top-down view into your application and infrastructure, showing the dependencies and communication links between containers....
Understanding Core Kubernetes Concepts & Components
Helm Charts in Kubernetes
How to Deploy and Access the Kubernetes Dashboard
Weave Scope is an open-source container visualization and troubleshooting project from Weaveworks that gives you a top-down view into your application and infrastructure, showing the dependencies and communication links between containers. It automatically detects your processes, containers, and hosts, allowing you to interact with them in real-time.
With Weave Scope, you can verify, troubleshoot, and debug your containerized microservices applications from your laptop to production. It also visualizes Kubernetes and Amazon ECS clusters, displays Kubernetes pods and namespaces, and shows ECS services, and tasks all from within the Scope interface.
Running Weave Scope in Weave Cloud
Run Weave Scope locally in standalone mode or use it within Weave Cloud, which includes Weave Scope and three other open-source projects: Weave Flux for continuous delivery, Weave Cortex for Prometheus monitoring, and Weave Net for security and networking. With Weave Cloud, you have the added benefits of host security, multitenancy, the ability to share access across your team, and by having us host Scope, it also minimizes any CPU and memory that may be used by Scope when you run it locally.
Sign up for Weave Cloud
If you’re curious about how Kubernetes cluster monitoring works within Weave Scope, sign up for a Weave Cloud trial and then follow the interactive tutorial: Troubleshooting Dashboard. This tutorial works entirely in your browser without having to download any software. The following visualizations are only visible if you already have Kubernetes installed and the Weave Scope probes deployed to your hosts.
Exploring the Sock Shop in Kubernetes
After you’ve set up a Kubernetes cluster, launched the Weave Scope probes onto the hosts, and deployed the Sock Shop app, you’re ready to visualize and explore the app as it runs in Kubernetes within Weave Cloud.
The Weave Cloud dashboard displays a number of views on the Sock Shop app. Click the “Explore” button in Weave Cloud to view processes sorted by their name or containers sorted by DNS or container image. You will also be able to see a number of Kubernetes-specific views, including Pods, Replica Sets, Deployments, and Services. Let’s look at those views here.
What are Weave Scope Views?
Views in Scope can be thought of as high-level filters on your containerized microservices app as it runs in the cloud. They are broadly categorized into: processes, containers, orchestrators, and hosts. The orchestrator view is context-sensitive, and because we deployed the app onto Kubernetes, Weave Cloud displays the Kubernetes view with the option to drill down on Pods, Replica Sets, Deployments, and Services. If you deployed the app to the Amazon EC2 cluster service, then Weave Cloud displays Services and Tasks, and other elements that make up an ECS cluster.
In addition to these basic views, nodes can be viewed in two different ways. Graph mode is useful for getting a quick overview of the connections between processes, containers, and hosts:
Another way to analyze your app in Weave Cloud is by using Table mode. In Table Mode, processes, containers, and pods are displayed in a convenient table that behaves much like the UNIX
top command does. It orders containers, processes, and nodes by CPU usage. It also dynamically sorts the resource-heavy containers, processes, pods, and nodes to the top of the list where they can be quickly identified:
Searching in Weave Cloud
To find a particular process, container, pod, or host, Scope provides a powerful and flexible search function. For example, the Sock Shop contains a microservice called cart. To quickly find the cart microservice, enter
cart into the search field to return all of the resources that reference that microservice.
Searches may also be nested to build complex queries and you can use common operands as well. For example to pinpoint a memory problem, enter
CPU > 70% into the search field to return all processes, containers, and hosts that are using more than 70% CPU.
Filtering by CPU and Memory Usage
Another way to quickly pinpoint CPU and memory issues with your app is to use the built-in filters found in the lower left-hand side of the UI. Filtering by memory or CPU provides a convenient visual cue about the processes, containers, and nodes that are using the most resources.
To look at the CPU usage of your Kubernetes cluster, set the CPU filter and then display the pod view. The diagram below shows CPU consumption for the Kubernetes API server and also everything connected to it.
Troubleshooting Containers in Real-time
Click on the ‘RabbitMQ’ container and then select
exec shell) to open a terminal to interact directly with a container. Enter the UNIX command
top to view the processes running inside of this container:
You can enter any other UNIX command you choose to troubleshoot problems with your microservices. Additional controls on the details panel also allow you to stop, pause, restart, and view the logs of a given container.
To view the logs from the kubernetes API server, select the
kube-apiserver container and then open the log terminal from the details panel. Also useful is the ability to
pop out the terminal window with the logs, so that you can continue troubleshooting your app and view the logs of kube-apiserver independently:
Follow the Step by Step Tutorial on Setting up Kubernetes, Deploying an App, and Visualizing it in Weave Cloud
If you require additional step-by-step instructions for setting up your environment, see Weaveworks’ guide “Troubleshooting with Weave Scope and Weave Cloud.” That tutorial shows you how to set up a sample microservices application, set up a Kubernetes cluster, launch the Weave Scope probes onto your host, and then verify and visualize your application all from one convenient dashboard in Weave Cloud.
Benefits of Running Weave Scope & Weave Cloud
By using Weave Scope in Weave Cloud, you gain several noteworthy benefits:
- Gain a complete picture of your container infrastructure. Weave Scope builds and displays an “intelligent map” of your application that shows the connections between processes, containers, and hosts, allowing you to easily view and inspect specific microservices.
- Verify that microservices are running as intended in real-time. This intelligent map in Weave Scope allows you to drill down and view the metadata of your containers and servers.
- Troubleshoot deployment problems. Weave Scope provides a convenient terminal window that enables you to interact with your application and to troubleshoot and diagnose issues, all within the same context. You can stop, start, and pause your containers all from within Weave Scope.
- Debug any services in real-time. Sometimes Kubernetes services need to be debugged, which can be time-consuming. Weave Scope’s capability to perform real-time interaction with and management of containers, as well as to generate reports and metrics about your application, is immensely useful during the debugging process.
- Running Weave Scope in Weave Cloud is particularly beneficial if you’re looking to deploy an app to a larger cluster, require secure remote access, or need to share access with your team.
The benefits and conveniences of Weave Scope & Weave Cloud, from building intelligent topology maps to controlling containers’ activity within a single user interface, are plentiful.
Weave Cloud gives you real-time monitoring of your containers, orchestrators, and microservices in order to understand and troubleshoot bugs and issues in containerized applications. In conjunction with your DevOps team, Weave Cloud can also provide continuous delivery of microservices by automating the tedious steps in between creating container images and deploying the service, including generating configuration files and checking them into source code control.
If you’re looking to leverage the power of Weave Scope and Weave Cloud for your microservices applications, sign up for the trial of Weave Cloud today.