Member-only story

ConfigMaps & Secret — Kubernetes

Always learning
4 min readNov 21, 2023

ConfigMaps and Secrets are used to store configuration data and secrets, respectively. ConfigMaps store configuration data as key-value pairs, while Secrets store sensitive data in an encrypted form.

LinkedIn Post 1 2

  1. Create a ConfigMap for your Deployment
  2. Create a ConfigMap for your Deployment using a file or the command line
apiVersion: v1
kind: ConfigMap
metadata:
name: todo-app
data:
name: django-todo-app
application: todo-app
protocol: TCP

Apply the changes using

kubectl apply -f configMap.yml

Update the deployment.yml file to include the ConfigMap

apiVersion: apps/v1
kind: Deployment
metadata:
name: config-todo-app
labels:
app: todo
namespace: todo-app
spec:
replicas: 2
selector:
matchLabels:
app: todo
template:
metadata:
labels:
app: todo
spec:
containers:
- name: todo
image: trainwithshubham/django-todo:latest
ports:
- containerPort: 8000
env:
- name: TODO_APP
valueFrom:
configMapKeyRef:
name: todo-app
key: application

--

--

Always learning
Always learning

Written by Always learning

கற்றுக் கொள்ளும் மாணவன்...

No responses yet