-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Hands-on Kubernetes on Azure, Third Edition
By :

Once secrets have been created, they need to be linked to the application. This means that Kubernetes needs to pass the value of the secret to the running pods in some way. Kubernetes offers two ways to link your secrets to your application:
Mounting secrets as files is the best way to consume secrets in your application. In this section, we will explain both methods, and also show why it's best to use the second method. Let's start by accessing secrets as environment variables.
You can use a secret in Kubernetes by referencing it as an environment variable. secrets can then be referenced in the pod definition under the containers
and env
sections. You will use the secrets that you previously created in a pod and learn how to use them in an application: