How to pass environment variables in angular application with docker How to pass environment variables in angular application with docker kubernetes kubernetes

How to pass environment variables in angular application with docker


For creating a file you need to use subPath.The value of the subPath must match the “key” of the ConfigMap. In the below example the key and subPath is config.yaml.

apiVersion: v1kind: ConfigMapmetadata:  name: sherlock-config  namespace: defaultdata:  config.yaml: |    namespaces:      - default    labels:      - "app"      - "owner"---apiVersion: v1kind: Podmetadata:  name: dapi-test-podspec:  containers:    - name: test-container      image: k8s.gcr.io/busybox      command: [ "/bin/sh", "-c", "ls /etc/config/" ]      volumeMounts:      - name: config-volume        mountPath: /etc/config/config.yaml        subPath: config.yaml  volumes:    - name: config-volume      configMap:        # Provide the name of the ConfigMap containing the files you want        # to add to the container        name: sherlock-config  restartPolicy: Never

kubectl describe cm sherlock-config

Name:         sherlock-configNamespace:    defaultLabels:       <none>Annotations:  kubectl.kubernetes.io/last-applied-configuration:                {"apiVersion":"v1","data":{"config.yaml":"namespaces:\n  - default\nlabels:\n  - \"app\"\n  - \"owner\"\n"},"kind":"ConfigMap","metadata":...Data====config.yaml: <------ This is the key----namespaces:  - defaultlabels:  - "app"  - "owner"Events:  <none>