Kubeshark Tutorial: Developer Track

Mar 05, 2024 - 10 min read
Debugging
Observability
Kubernetes
Tutorials
Kubeshark Tutorial: Developer Track

Abstract

This blog post is a work in progress, offering detailed instructions on the installation, troubleshooting, and maximizing the value derived from Kubeshark.

It provides a hands-on introduction to Kubeshark, a tool that simplifies debugging and monitoring containerized applications in Kubernetes environments.

The guide is segmented into three focused tracks to cater to different user needs:

This post is the first of three and focuses on the Developer Track. The other two tracks will follow shortly.

Objectives

Installing Prerequisites

Begin by installing a Kubernetes cluster. In this example, we'll be using Kind (Kubernetes in Docker), kubectl, and Kubeshark. The aim is to acquaint yourself with the operational environment of Kubeshark.

While its meant to work out-of-the-box, identifying and mitigating potential obstacles is essential for a smooth experience. Installation instructions for Mac are as follows:

brew install kind kubectl kubeshark

> Explore more installation techniques and find comprehensive instructions in the Kubeshark Installation Guide.

For installations using Helm, refer to the DevOps Track (coming soon).

After installing all prerequisites, ensure they are correctly installed by following these steps:

kubeshark version
kubectl version
kind version

The results should look like this:

Kind

Kind, short for "Kubernetes IN Docker," is an essential tool for developers, facilitating the creation of local Kubernetes clusters using Docker. It's particularly useful for development, testing, and CI/CD processes, allowing for rapid, resource-efficient Kubernetes experimentation on a personal machine. As a project endorsed by Kubernetes, Kind simplifies the complexities of Kubernetes application development and testing without necessitating a full cluster setup.

kubectl

kubectl stands as the cornerstone command-line utility for Kubernetes cluster management. It empowers users to deploy applications, manage cluster resources, and access logs through interactions with the cluster's API server. kubectl is indispensable for navigating the Kubernetes ecosystem, offering a broad spectrum of commands for comprehensive cluster administration.

Create a Kubernetes Cluster

To commence, create a local Kubernetes cluster with the following command:

kind create cluster

Installing the Demo Application

Enhance your Kubeshark experience with a demo application, designed to generate traffic across various supported protocols. Use the following command to install the demo application.

kubectl apply -f https://raw.githubusercontent.com/kubeshark/sock-shop-demo/master/deploy/kubernetes/complete-demo.yaml
	

While not mandatory, you can clone the full repo from here.

Run Kubeshark

Launch Kubeshark using the `tap` command to automatically open a browser window showcasing the Kubeshark dashboard:

kubeshark tap

Troubleshooting

Dashboard Doesn't Open

Should the dashboard fail to open, the most common culprit is an occupied default dashboard port, identifiable through CLI log messages.

Resolution involves either terminating the port-occupying application or opting for an alternate port.

kubeshark tap --proxy-front-port 18001

No Traffic in the Dashboard

An empty dashboard signals a potential issue. Begin with an examination of the browser console log for errors. Absence of errors there necessitates a review of worker log files, as the problem may stem from worker connectivity issues, typically due to non-operational worker pods.

Developer Track Conclusion

Observing traffic on the dashboard signifies a successful completion of the Developer Track, paving the way to the User Track (comming soon).

Recommended