Skip to main content

Command Palette

Search for a command to run...

DevOps(Day-35) : Mastering ConfigMaps and Secrets in Kubernetes

Published
2 min read
DevOps(Day-35) : Mastering ConfigMaps and Secrets in Kubernetes
B

I like to explore the technology in DevOps area where I write blog about my learning each day on the tools that is mostly used in Industries for DevOps practices. You can go through my blogs and reach me out in LinkedIn for any suggestions.

ConfigMaps

The ConfigMap API resource holds key-value pairs of configuration data that can be consumed in pods or used to store configuration data for system components such as controllers.

ConfigMaps are intended for non-sensitive data—configuration data—like config files and environment variables and are a great way to create customized running services from generic container images.

Secrets

Secrets are Kubernetes objects intended for storing a small amount of sensitive data. It is worth noting that Secrets are stored base64-encoded within Kubernetes, so they are not wildly secure.

To create the Secret, choose a password and convert it to base64 as shown in below example:

# The root password will be "KubernetesRocks!"
$ echo -n 'KubernetesRocks!' | base64
S3ViZXJuZXRlc1JvY2tzIQ==

Task-1: Create ConfigMap for your Deployment

  1. Create a configmap.yml file to include all the configurations required.

  2. Run the file using kubectl command.

  3. Change the deployment.yml file to include the configMap properties in the deployment.

  4. Run the deployment file and check for the deployment and config map are running.

  5. Use the describe command for a detailed view of the config map.

  6. Navigate inside the Pod and check the environment variable and the application for detailed status.

    Task-2 : Secrets in K8s

    1. Create a secret.yml file which includes the base64 encoded password.

    2. To add the password in the above file you need to generate the base64 encoded password.

    3. Now you can save and run the secret.yml file.

    4. Now, change the deployment.yml file to include the configuration of the secret in the deployment.

    5. Now run the deployment file and check the status of the deployment and the secret.

    6. Check the detailed view of secretly created in K8s using describe command.

    7. Now check the running pods and navigate to a POD to view the environment variable.

      Thanks for reading my article. Have a nice day.

      You can follow me on LinkedIn for my daily updates:- linkedin.com/in/bandan-kumar-sahoo-131412203

More from this blog

Untitled Publication

98 posts