Use config maps to configure a deployment
A config map is a configuration file that holds a sort of variables to be used in the configuration of a deployment.
This example shows how to configure the configuration of a database.
apiVersion: V1
kind: ConfigMap
metadata:
name: test-configmap #name the configmap
data:
#Conexion db
DB_HOST: 127.0.0.1
DB_PORT: '3306'
DB_NAME: 'test_load'
DB_USER: 'user'
DB_PASS: '1234'Configmaps are not recommended for sensible data configuration.
Load file to kubernetes cluster.
kubectl apply -f <path>Use in a deployment file.
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: test-configmap
key: DB_HOSTFurther example.
Reference Links
Last updated