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
Kubernetes – CKA Certification Overview – By DevOpsSchool.com
Kubernetes – CKA Certification | Part 1 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 2 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 3 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 4 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 5 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 6 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 7 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 8 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 9 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 10 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 11 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 12 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 13 out 14 | — By DevOpsSchool
Kubernetes – CKA Certification | Part 14 out 14 | — By DevOpsSchool
Latest posts by Rajesh Kumar (see all)
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024