Skip to content

Commit 5327167

Browse files
- added make target for setting up tracing
- changed jaeger-service to a load-balancer - updated observability.md docs
1 parent a6f3624 commit 5327167

File tree

4 files changed

+112
-3
lines changed

4 files changed

+112
-3
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,8 @@ install-grafana:
213213
.PHONY: setup-dashboard
214214
setup-dashboard:
215215
KUBECONFIG=test-cluster-kubeconfig.yaml ./hack/setup-dashboard.sh --namespace=monitoring --dashboard-file=observability/metrics/dashboard.json
216+
217+
218+
.PHONY: setup-tracing
219+
setup-tracing:
220+
KUBECONFIG=test-cluster-kubeconfig.yaml ./hack/setup-tracing.sh

docs/observability.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Observability with Grafana Dashboard
1+
# Observability for CSI Driver
22

3-
This document explains how to use the `grafana-dashboard` make target to install and configure observability tools, including Prometheus and Grafana, on your Kubernetes cluster. The setup uses Helm charts to install Prometheus and Grafana, provides a Prometheus data source, and applies a Grafana dashboard configuration.
3+
This document explains how to use the `grafana-dashboard`, `setup-tracing` make targets to install and configure observability tools.
44

55
## Prerequisites
66

@@ -183,4 +183,55 @@ kubectl logs <grafana-pod-name> -n monitoring
183183

184184
This setup provides a quick and easy way to enable observability using Grafana dashboards, ensuring that you have visibility into your Kubernetes cluster and CSI driver operations.
185185

186-
---
186+
---
187+
188+
## Steps to Opt-In for Tracing in the CSI Driver
189+
190+
To enable the tracing for the Linode CSI driver, follow the steps below. These steps involve exporting a new Helm template with tracing enabled, deleting the current CSI driver release, and applying the newly generated configuration.
191+
192+
### 1. Export the Helm Template for the CSI Driver with Tracing Enabled
193+
194+
First, you need to generate a new Helm template for the Linode CSI driver with the `enableTracing` flag set to `true`. You will also have to specify an address that isn't in use for the otel server to run on. By default, the port is set to `4318`.
195+
196+
```bash
197+
helm template linode-csi-driver \
198+
--set apiToken="${LINODE_API_TOKEN}" \
199+
--set region="${REGION}" \
200+
--set enableTracing="true" \
201+
--set tracingPort="4318" \
202+
helm-chart/csi-driver --namespace kube-system > csi.yaml
203+
```
204+
205+
### 2. Delete the Existing Release of the CSI Driver
206+
207+
Before applying the new configuration, you need to delete the current release of the Linode CSI driver. This step is necessary because the default CSI driver installation does not have tracing enabled, and Helm doesn’t handle changes to some components gracefully without a clean reinstall.
208+
209+
```bash
210+
kubectl delete -f csi.yaml --namespace kube-system
211+
```
212+
213+
### 3. Apply the Newly Generated Template
214+
215+
Once the old CSI driver installation is deleted, you can apply the newly generated template that includes the tracing configuration.
216+
217+
```bash
218+
kubectl apply -f csi.yaml
219+
```
220+
221+
## Steps to Install otel and jaeger for visualizing traces
222+
223+
### 1. Run the Tracing setup
224+
225+
The make target `setup-tracing` installs `otel-collector` and `jaeger` for visualizing the traces.
226+
227+
```bash
228+
make setup-tracing
229+
```
230+
231+
### 2. Access the Jaeger Dashboard
232+
233+
Once the setup is complete, you can access the jaeger dashboard through the configured LoadBalancer service. After the setup script runs, the external IP of the LoadBalancer is printed, and you can access Jaeger by opening the following URL in your browser:
234+
235+
```
236+
http://<LoadBalancer-EXTERNAL-IP>:16686
237+
```

hack/setup-tracing.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
set -euf -o pipefail
4+
5+
# Default Values
6+
NAMESPACE="kube-system"
7+
TRACING_FILES=("observability/tracing/otel-configmap.yaml"
8+
"observability/tracing/otel-deployment.yaml"
9+
"observability/tracing/otel-service.yaml"
10+
"observability/tracing/jager-deployment.yaml"
11+
"observability/tracing/jager-service.yaml")
12+
13+
# Ensure namespace exists
14+
if ! kubectl get namespace "${NAMESPACE}" > /dev/null 2>&1; then
15+
echo "Namespace '${NAMESPACE}' does not exist. Creating..."
16+
kubectl create namespace "${NAMESPACE}"
17+
else
18+
echo "Namespace '${NAMESPACE}' already exists."
19+
fi
20+
21+
# Apply each file
22+
echo "Applying tracing YAML files..."
23+
for file in "${TRACING_FILES[@]}"; do
24+
if [[ -f "$file" ]]; then
25+
echo "Applying $file..."
26+
kubectl apply -f "$file" --namespace ${NAMESPACE}
27+
else
28+
echo "Error: File $file not found. Exiting..."
29+
exit 1
30+
fi
31+
done
32+
33+
# Retrieve and print the Jaeger LoadBalancer IP
34+
get_jaeger_lb_ip() {
35+
kubectl get svc jaeger-collector -n ${NAMESPACE} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
36+
}
37+
38+
echo "Waiting for Jaeger LoadBalancer to get an external IP..."
39+
EXTERNAL_IP=""
40+
while [[ -z "$EXTERNAL_IP" ]]; do
41+
EXTERNAL_IP=$(get_jaeger_lb_ip)
42+
if [[ -z "$EXTERNAL_IP" ]]; then
43+
echo "Waiting for LoadBalancer external IP..."
44+
sleep 10
45+
fi
46+
done
47+
48+
echo "------------------------------------------------------------"
49+
echo "Jaeger Dashboard Setup Complete!"
50+
echo "Access Jaeger using the following URL:"
51+
echo " - http://${EXTERNAL_IP}:16686"
52+
echo "------------------------------------------------------------"

observability/tracing/jager-service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
labels:
77
app: jaeger
88
spec:
9+
type: LoadBalancer
910
selector:
1011
app: jaeger
1112
ports:

0 commit comments

Comments
 (0)