--- tags: blog, kubernetes --- # Kubernetes: How to define container environment variables via config map? First create a config map and name the keys like the environment variables you like to inject into an container ```yml apiVersion: v1 kind: ConfigMap metadata: name: my-config-map data: SOME_USERNAME: admin SOME_SECRET: 123456 ``` Second add the config map to your container specification ```yml apiVersion: apps/v1 kind: Deployment ... spec: ... template: ... spec: containers: - image: localhost:32000/service name: some-service resources: {} envFrom: - configMapRef: name: my-config-map ```