1

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.

angela
  • 11
  • 2

1 Answers1

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