Lab 11.3 - Logging Configuration
Lab Objectives
By the end of this lab, you will be able to:
- Understand logging in Kubernetes.
- Install Fluent Bit for log collection.
- Configure log collection from Pods.
- Visualize logs in a centralized system.
Estimated Duration
45-60 minutes
Prerequisites
- kubectl installed and configured.
- Working local Kubernetes cluster.
Part 1: Installing Fluent Bit
Step 1.1: Install with Helm
helm repo add fluent https://fluent.github.io/helm-charts
helm repo update
helm install fluent-bit fluent/fluent-bit --namespace logging --create-namespace
Part 2: Configuring Collection
Step 2.1: Create Test Pods
Create Pods that generate logs:
apiVersion: v1
kind: Pod
metadata:
name: log-generator
spec:
containers:
- name: app
image: busybox:1.35
command: ["/bin/sh", "-c"]
args: ["while true; do echo '$(date): Log entry from pod'; sleep 5; done"]
Part 3: Viewing Logs
Step 3.1: Verify Collected Logs
kubectl logs -n logging -l app.kubernetes.io/name=fluent-bit
Lab Summary
In this lab, you configured logging with Fluent Bit. You learned how to collect and centralize logs from Kubernetes applications.
Next Steps
The final lab of this module will show you how to configure alerting and notifications.
Lab 11.4: Alerting and Notifications
Lab created on: December 2024