A ConfigMap is a Kubernetes API object for storing non-sensitive configuration as key-value pairs. Workloads can consume values without embedding environment-specific settings in their definitions. section 3.3.5
Define configuration
Create a ConfigMap with apiVersion v1, kind ConfigMap, a metadata.name, and a data map. A practical example stores database-url and environment values in test-configmap. Apply it with kubectl create -f, then inspect it using kubectl get configmaps or kubectl describe configmap test-configmap. section 3.3.5
Listing 3.10 config-map.yaml: creating a ConfigMap
apiVersion: v1 #1 kind: ConfigMap #2 metadata: name: test-configmap #3 data: #4 database-url: "cloudsql-proxy.prod.company.data" environment: sandbox
Shows the complete minimal manifest structure for creating a ConfigMap with two configuration entries. section 3.3.5
Expose individual entries to a container through env.valueFrom.configMapKeyRef. The reference names the ConfigMap and the required key, allowing a pod to receive DATABASE_URL from database-url. section 3.3.5
apiVersion: v1
kind: Pod
metadata:
name: pod-using-configmap
spec:
containers:
- name: container-using-configmap
image: ubuntu
env:
- name: DATABASE_URL
valueFrom:
configMapKeyRef:
name: test-configmap
key: database-url
- name: API_KEY
valueFrom:
configMapKeyRef:
name: test-configmap
key: api-key
Shows a pod consuming ConfigMap keys as environment variables and illustrates the name-and-key reference pattern. section 3.3.5
Keep credentials in a Secret rather than a ConfigMap. Secrets are represented separately, with opaque data and base64-encoded values, while ConfigMaps hold ordinary settings such as URLs and environment names. section 3.3.5
Configure Kubeflow notebook options
Kubeflow uses a ConfigMap, usually named with jupyter-web-app-config in the kubeflow namespace, to control notebook menu options. Its embedded configuration can set default images, list selectable images, and mark options read-only. Similar configuration exposes node-affinity choices for notebook placement. section 7.1.4
Listing 7.2 Jupyter web app ConfigMap
apiVersion: v1
data:
spawner_ui_config.yaml: >
spawnerFormDefaults:
image:
value: kubeflownotebookswg/jupyter-scipy:v1.6.1
options:
- asia.gcr.io/kubeflow-notebook-servers/jupyter-tensorflow:2.6.0
- asia.gcr.io/kubeflow-notebook-servers/jupyter-pytorch:1.9.0
imageGroupOne:
- kubeflownotebookswg/codeserver-python:v1.6.1
imageGroupTwo:
- kubeflownotebookswg/rstudio-tidyverse:v1.6.1
Displays a Jupyter web app ConfigMap whose embedded YAML configures default notebook images and selectable alternatives. section 7.1.4







