Exposing labels and annotations in Pods

Kubernetes can expose data about a Pod in a container directly, typically as files in a specific filesystem, which your code can read and use. Labels, annotations, and more can be made available as files in your container through the container specification, and using what Kubernetes calls the downwardAPI.

This can be a convenient way to expose annotation information such as build time, source code reference hash, and so forth in a container so that your runtime code can read and reference the information.

To make the Pods labels and annotations available, you define a volume mount for the container, and then specify the downwardAPI and items from it for the volume mount point.

Update the flask deployment ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.