Scenario
You are assigned the task of making a Kubernetes installation for a simple application with self-awareness. In this installation, the application should collect all the runtime information from Kubernetes and write to its logs.
Aim
With the successful deployment, there should be a pod running in Kubernetes with only one container. In this container, all available runtime information should be injected as environment variables. Also, the application should log runtime information.
Prerequisites
Use the Kubernetes Downward API to collect runtime information.
Steps for Completion
- Create a pod definition with one container:
- Define the environment variables from the Downward API.
- Create a shell script to write the environment variables.
- Deploy the pod.
- Check the status of the pod.
- Check the logs of the container.
All of the code files for the activities in this chapter are provided on GitHub in the Lesson-1 folder at https://goo.gl/gM8W3p.