DevOps Classroom notes 12/Jan/2026

Config Maps

  • Lets try to write a mysql pod
---
apiVersion: v1
kind: Pod
metadata:
  name: mysql-pod
  labels:
    app: mysql
spec:
  containers:
    - name: mysql
      image: mysql:5.7
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: admin123
        - name: MYSQL_DATABASE
          value: mydb
        - name: MYSQL_USER
          value: myuser
        - name: MYSQL_PASSWORD
          value: mypassword
      ports:
        - containerPort: 3306

  • Ideally configuration values should be dealt seperately for this k8s gives
    • configMaps: Non confidentail data
    • secrets: confidential data

example mysql-configuration

  • cm
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql-cm
data:
  MYSQL_ROOT_PASSWORD: admin123
  MYSQL_DATABASE: mydb
  MYSQL_USER: myuser
  MYSQL_PASSWORD: mypassword
  • pod
---
apiVersion: v1
kind: Pod
metadata:
  name: mysql-pod
  labels:
    app: mysql
spec:
  containers:
    - name: mysql
      image: mysql:5.7
      envFrom:
        - configMapRef: 
            name: mysql-cm
      ports:
        - containerPort: 3306

  • config map values injected as environmental varaibles while the pod is getting created and will not automatically update with in same pod if you change config map post pod creation.
  • secrets encode the plain text
  • secret
---
apiVersion: v1
kind: Secret
metadata:
  name: mysql-secret
data:
  MYSQL_ROOT_PASSWORD: YWRtaW4xMjM=
  MYSQL_DATABASE: bXlkYg==
  MYSQL_USER: bXl1c2Vy
  MYSQL_PASSWORD: bXlwYXNzd29yZA==
  • mysql-pod
---
apiVersion: v1
kind: Pod
metadata:
  name: mysql-pod
  labels:
    app: mysql
spec:
  containers:
    - name: mysql
      image: mysql:5.7
      envFrom:
        - secretRef: 
            name: mysql-secret
      ports:
        - containerPort: 3306

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube