Create and Manage ConfigMaps¶
Let's see how we can create and manage ConfigMaps
.
Step 1: Create a ConfigMap¶
Observe the following:
- The
data
field is where we define key-value pairs - There are two property-like keys
foo1
, andfoo2
- There are two file-like keys
game.properties
, anddefault.conf
Apply the manifest to create the ConfigMap:
Step 2: List ConfigMaps¶
Resource types are case-insensitive and you can specify the singular, plural, or abbreviated forms.
The following commands produce the same output:
Note
configmap
is abbreviated as cm
.
Step 3: Describe a ConfigMap¶
# Command template
kubectl describe configmap <configmap-name>
{OR}
kubectl describe configmap/<configmap-name>
# Actual command
kubectl describe configmap my-configmap
{OR}
kubectl describe configmap/my-configmap
Step 4: Delete a ConfigMap¶
# Command template
kubectl delete configmap <configmap-name>
{OR}
kubectl delete configmap/<configmap-name>
# Actual command
kubectl delete configmap my-configmap
{OR}
kubectl delete configmap/my-configmap
You can also use the manifest to delete the resource as follows: