
Content of reverseproxy.conf
---------------------------
server {
listen 80;
server_name localhost;
location / {
proxy_bind 127.0.0.1;
proxy_pass http://127.0.0.1:3000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Commands to execute to create configmap
---------------------------
kubectl create configmap my-config --from-file=reverseproxy.conf
kubectl get cm
kubectl describe cm my-config
Example pod using configmap
---------------------------
apiVersion: v1
kind: Pod
metadata:
name: helloworld-nginx
labels:
app: helloworld-nginx
spec:
containers:
- name: nginx
image: nginx:1.11
ports:
- containerPort: 80
volumeMounts:
- name: config-volume
mountPath: /etc/nginx/conf.d
- name: k8s-demo
image: wardviaene/k8s-demo
ports:
- containerPort: 3000
volumes:
- name: config-volume
configMap:
name: my-config
items:
- key: reverseproxy.conf
path: myconfo.conf
Validating configmap inside a pod
---------------------------
kubectl exec -it helloworld-nginx /bin/bash
cd /etc/nginx/conf.d

















I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND