HOW TO MANAGE KUBERNETES BUILT IN SECRET
Secret is an object that stores and manages sensitive information like API Keys, TSL certificates, Passwords etc. Secret can be manually created or automatically generated and it is configured in the environment variable, volume and manifest file. For example:
TYPES OF SECRET
HOW DO WE MANAGE SECRETS IN KUBERNETES.
There are two ways to create a secret.
First, we define a "secret.yaml file" and this specifies the Kind, Metadata and Value. The value has different numbers and its encrypted and coded in "Base64"
BASE64: This is used to encode data in email attachment and can represent binary data in JSON / XML format etc.
NB: Yaml and Json - Are data exchange format.
- First, we can introduce it as an environment variables within the container when defining the POD/ CONTAINER in the manifest file. We define the "env" where the value should be pulled from a "reference" to that secret we created. Then, it can reference the key value pair. The application can run within the container to access the "process.env.API_TOKEN (JAVASCRIPT/PYTHON)"
- The second method to consume secret is through "MOUNT VOLUME". This helps when we want to configure and consume sensitive information such as reading an SSL certificate manager.
- We declare the volume within the the pod that reference our secret.
- We create a "volume mount with in the container specification"
No comments:
Post a Comment