I'm new to kubernetes. I would like to know how to pass default.yaml in secrets to env in deployment? i tried it separately but it saves the default empty and i want to override it Thank you.
Asked
Active
Viewed 157 times
1
-
What is default.yaml – P.... Jul 28 '21 at 19:33
-
a file of all the default vars that i pass so the db can connect and persist (MongoDB) – angela Jul 28 '21 at 19:38
-
1you should add your manifest files for more clarity. – P.... Jul 28 '21 at 20:34
1 Answers
1
You can store the file in Secret or Configmap
Example :
apiVersion: v1
kind: Secret
metadata:
name: nginx-data
data:
default.yaml: |-
server {
server_name _;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_certificate /etc/cert/tls.crt;
ssl_certificate_key /etc/cert/tls.key;
location / {
proxy_pass http://127.0.0.1:80;
}
}
and inject it into the POD as per requirement. Update default.yaml
as per need.
You can store and create the YAML inside the secret and inject into the deployment of MongoD it will work.
Configmap example : https://www.cloudytuts.com/guides/kubernetes/how-to-deploy-mongodb-on-kubernetes/
For more : https://www.jeffgeerling.com/blog/2019/mounting-kubernetes-secret-single-file-inside-pod

Harsh Manvar
- 27,020
- 6
- 48
- 102