This tutorial will walk you through setting up Zipkin on Kubernetes, assuming that you already have K3s and Helm set up. Microservices have become a key element in the quickly changing world of software development. Distributed tracing systems like Zipkin have become very popular in tandem with this explosion in microservices. An open-source distributed tracing tool called Zipkin helps developers understand how data moves throughout their systems. Contrarily, Kubernetes is a well-known platform for managing, scaling, and automating the deployment of containerized applications.
Requirements
Before we dive in, it’s important to ensure that you have the following prerequisites:
- A functioning Virtono Kubernetes cluster (K3s), you can find the installation guide here
- Helm, the package manager for Kubernetes, you can find the installation guide here
- Docker, for running Zipkin as a container
- Basic understanding of Kubernetes and Helm charts
If you don’t have Docker installed, don’t worry. We’ll cover the installation process in the next section.
Installing Docker
Docker is a platform that enables automated application deployment, scaling, and management inside of containers. Here’s how to set it up:
Update your existing list of packages:
sudo apt update
Install a few prerequisite packages that let apt use packages over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add the GPG key for the official Docker repository to your system:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Update the package database with the Docker packages from the newly added repo:
sudo apt update
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
apt-cache policy docker-ce
Finally, install Docker:
sudo apt install docker-ce
Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
sudo systemctl status docker
Deploying Zipkin on Kubernetes
Having installed Docker, we can now proceed with the deployment of Zipkin on our Kubernetes cluster. This process involves several steps, including preparing the Kubernetes cluster, installing Zipkin, deploying Zipkin on Kubernetes, exposing the Zipkin service, and verifying the deployment. Let’s dive into each of these steps.
Step 1: Preparing the Kubernetes Cluster
Make sure your Kubernetes cluster is operational first. To check the status of your nodes if you’re using k3s, run the command k3s kubectl get nodes. Your nodes’ statuses should be listed if everything is configured properly.
Step 2: Installing Zipkin on Kubernetes
Zipkin is available as a Docker image, so you can pull it directly from Docker Hub. Run the following command to download the Zipkin image: docker pull openzipkin/zipkin
.
Step 3: Deploying Zipkin on Kubernetes
Once we have the Zipkin Docker image, we can install it on our Kubernetes cluster. For Zipkin, we’ll make a deployment configuration file. Give it the name “zipkin-deployment.yaml.” An example of this configuration file would be as follows:
apiVersion: apps/v1
kind: Deployment
metadata:
name: zipkin
spec:
replicas: 1
selector:
matchLabels:
app: zipkin
template:
metadata:
labels:
app: zipkin
spec:
containers:
- name: zipkin
image: openzipkin/zipkin
ports:
- containerPort: 9411
This configuration creates a deployment with the name “zipkin” that will run the Zipkin Docker image we previously downloaded. Additionally, it exposes port 9411, Zipkin’s standard port.
Use the kubectl apply -f zipkin-deployment.yaml
command to deploy Zipkin. On your Kubernetes cluster, this will create the Zipkin deployment.
Step 4: Exposing Zipkin Service
We must expose the Zipkin UI as a service in Kubernetes in order to make it accessible from a web browser. The zipkin-service.yaml
file should be created and should contain the following details:
apiVersion: v1
kind: Service
metadata:
name: zipkin
spec:
type: NodePort
ports:
- port: 9411
targetPort: 9411
nodePort: 32000
selector:
app: zipkin
This configuration creates a service that exposes the Zipkin deployment on port 32000 of your nodes. To create the service, run the command: kubectl apply -f zipkin-service.yaml
.
Step 5: Verifying the Deployment
By using the kubectl get pods
command, you can check to see if Zipkin is functioning properly. You should see the Zipkin pod listed among the currently active pods.
You can also access the Zipkin on Kubernetes UI by navigating to http://<your_node_ip>:32000
in your web browser. If everything is set up correctly, you should see the Zipkin UI.
Final Thoughts
Setting up Zipkin on Kubernetes can seem difficult, but with the right resources and advice, it becomes simple. The purpose of this guide was to offer a simple and thorough route to completing this task. Never forget to verify that your services and deployments are functioning as expected. You are well-equipped to trace and monitor your microservices efficiently with Zipkin on Kubernetes.
0 Comments