

Related content: read our guide to Kubernetes pods › Immutable ConfigMaps To access the data, change your command line instructions to look for files in the directory matching the keys in the ConfigMap.

Use an existing ConfigMap or create a new one.To ingest a ConfigMap in a volume within a pod: Defining a ConfigMap separately from pods and using them for other components of the Kubernetes cluster.Accessing the ConfigMap remotely by pods in the same namespace.There are three main ways to ConfigMaps can be accessed:
#Kubectl create deployment command line how to#
The output looks like this: How to Consume Kubernetes ConfigMaps To view the ConfigMap in YAML format, use this command: In this example the ConfigMap was created from two files, game.properties and ui.properties. Each key, which was created based on a filename, is followed by the separator “-”. To view the data in a ConfigMap via console output, use the command: Kubectl create configmap app-settings -from-file=app-container/settings/ Kubectl create configmap app-env-file-from-env-file=app-container/settings/app-env-file.properties Kubectl create configmap app-settings -from-file=app-container/settings/app.properties-from-file=app-container/settings/backend.properties Kubectl create configmap app-settings -from-file=app-container/settings/app.properties The basename of each file is used as the key, and the contents of the file becomes the value. You can create ConfigMaps based on one file, several files, directories, or env-files (lists of environment variables). The indicates the files or values from which ConfigMap data should be obtained.

The is the name of the ConfigMap, which should be valid for use as a DNS subdomain. To create a new ConfigMap, use this kubectl command:
#Kubectl create deployment command line code#
The code examples in this section were shared in the Kubernetes documentation.
