DevOps Coding Challenge #7: Parallel Pod Logger
Kubernetes Parallel Pod Logger: DevOps Challenge to Boost Observability Skills
Level: Intermediate
Languages: Python or Go
Focus: Kubernetes API, Concurrency, Observability
Problem Statement
You're debugging an issue affecting multiple pods across namespaces. You need to fetch logs for all matching pods in parallel to speed up troubleshooting.
Your task:
Write a CLI tool (in Python or Go) that:
Accepts a label selector (e.g.,
app=backend
)Runs across all namespaces
Fetches logs from all matching pods concurrently
Stores each log into a separate file in a local
logs/
folder
Core Requirements
Accept the following CLI flags:
--selector
(label selector likeapp=web
)--since
(optional, logs from last X minutes)--limit
(optional, max number of pods to fetch logs for)
Fetch logs only from containers in
Running
stateUse concurrent workers to fetch logs (e.g., goroutines in Go, ThreadPool in Python)
Save logs in files named:
logs/<namespace>_<pod-name>.log
Bonus Features
Add a
--container
flag to specify which container to target (if pod has multiple)Add a progress bar (like
tqdm
in Python orpb
in Go)Add retry logic for transient API errors
Add
--dry-run
to show which pods would be logged
Tech Suggestions
Python:
Use
kubernetes
Python clientUse
concurrent.futures.ThreadPoolExecutor
Use
argparse
for CLIUse
datetime
to filter logs usingsince_seconds
Docs: https://github.com/kubernetes-client/python
Go:
Use
client-go
Use
Cobra
for CLIUse
context.WithTimeout
Use
sync.WaitGroup
or goroutines with channels
Docs: https://github.com/kubernetes/client-go
Evaluation Criteria
Efficient concurrent log fetching
Clean folder structure and CLI UX
Error handling and retries
Bonus points for: container selection, dry-run, progress feedback