Challenge, Easy,  on  Kubernetes

Kubernetes - Normalize Application Output with an Adapter Container

In this challenge you will apply the adapter container pattern. The main app writes pipe-delimited log lines to a shared volume; an adapter container reads and transforms them into a clean, space-separated format.

Task 1 - Create the Pod

Create a Pod named adapter-pod with:

  • Container app (busybox): writes pipe-delimited log lines to /logs/app.log every 3 seconds Command: sh -c "while true; do echo 'ERROR|SomeTimestamp|something broke' >> /logs/app.log; sleep 3; done"
  • Container adapter (busybox): reads and transforms the log lines, stripping pipe characters Command: sh -c "while true; do cat /logs/app.log | sed 's/|/ /g'; sleep 3; done"
  • Both containers mount an emptyDir volume at /logs

Task 2 - Verify the Adapter Output

Check the adapter container logs and confirm that:

  • The output contains ERROR
  • The output does not contain any | characters
kubectl wait pod adapter-pod --for=condition=Ready --timeout=60s
kubectl logs adapter-pod -c adapter