Skip to content

Commit 743df5f

Browse files
author
Tim Bannister
committed
Add cleanup steps
1 parent 67aa567 commit 743df5f

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ For example, to generate a ConfigMap from files `configure-pod-container/configm
403403
cat <<EOF >./kustomization.yaml
404404
configMapGenerator:
405405
- name: game-config-4
406+
labels:
407+
game-config: config-4
406408
files:
407409
- configure-pod-container/configmap/game.properties
408410
EOF
@@ -435,7 +437,7 @@ kubectl describe configmaps/game-config-4-m9dm2f92bt
435437
```
436438
Name: game-config-4-m9dm2f92bt
437439
Namespace: default
438-
Labels: <none>
440+
Labels: game-config=config-4
439441
Annotations: kubectl.kubernetes.io/last-applied-configuration:
440442
{"apiVersion":"v1","data":{"game.properties":"enemies=aliens\nlives=3\nenemies.cheat=true\nenemies.cheat.level=noGoodRotten\nsecret.code.p...
441443
@@ -467,6 +469,8 @@ with the key `game-special-key`
467469
cat <<EOF >./kustomization.yaml
468470
configMapGenerator:
469471
- name: game-config-5
472+
labels:
473+
game-config: config-5
470474
files:
471475
- game-special-key=configure-pod-container/configmap/game.properties
472476
EOF
@@ -505,6 +509,15 @@ kubectl apply -k .
505509
configmap/special-config-2-c92b5mmcf2 created
506510
```
507511

512+
## Interim cleanup
513+
514+
Before proceeding, clean up some of the ConfigMaps you made:
515+
516+
```bash
517+
kubectl delete configmap special-config
518+
kubectl delete configmap env-config
519+
kubectl delete configmap -l 'game-config in (config-4,config-5)’
520+
```
508521
509522
Now that you have learned to define ConfigMaps, you can move on to the next
510523
section, and learn how to use these objects with Pods.
@@ -558,6 +571,11 @@ Here is the manifest you will use:
558571

559572
Now, the Pod's output includes environment variables `SPECIAL_LEVEL_KEY=very` and `LOG_LEVEL=INFO`.
560573
574+
Once you're happy to move on, delete that Pod:
575+
```shell
576+
kubectl delete pod dapi-test-pod --now
577+
```
578+
561579
## Configure all key-value pairs in a ConfigMap as container environment variables
562580

563581
* Create a ConfigMap containing multiple key-value pairs.
@@ -570,6 +588,7 @@ Here is the manifest you will use:
570588
kubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml
571589
```
572590

591+
573592
* Use `envFrom` to define all of the ConfigMap's data as container environment variables. The
574593
key from the ConfigMap becomes the environment variable name in the Pod.
575594
@@ -583,6 +602,11 @@ Here is the manifest you will use:
583602
Now, the Pod's output includes environment variables `SPECIAL_LEVEL=very` and
584603
`SPECIAL_TYPE=charm`.
585604

605+
Once you're happy to move on, delete that Pod:
606+
```shell
607+
kubectl delete pod dapi-test-pod --now
608+
```
609+
586610
## Use ConfigMap-defined environment variables in Pod commands
587611
588612
You can use ConfigMap-defined environment variables in the `command` and `args` of a container
@@ -605,6 +629,11 @@ That pod produces the following output from the `test-container` container:
605629
very charm
606630
```
607631
632+
Once you're happy to move on, delete that Pod:
633+
```shell
634+
kubectl delete pod dapi-test-pod --now
635+
```
636+
608637
## Add ConfigMap data to a Volume
609638

610639
As explained in [Create ConfigMaps from files](#create-configmaps-from-files), when you create
@@ -651,6 +680,11 @@ If there are any files in the `/etc/config` directory of that container image, t
651680
mount will make those files from the image inaccessible.
652681
{{< /note >}}
653682
683+
Once you're happy to move on, delete that Pod:
684+
```shell
685+
kubectl delete pod dapi-test-pod --now
686+
```
687+
654688
### Add ConfigMap data to a specific path in the Volume
655689

656690
Use the `path` field to specify the desired file path for specific ConfigMap items.
@@ -674,6 +708,12 @@ very
674708
Like before, all previous files in the `/etc/config/` directory will be deleted.
675709
{{< /caution >}}
676710

711+
Delete that Pod:
712+
```shell
713+
kubectl delete pod dapi-test-pod --now
714+
```
715+
716+
677717
### Project keys to specific paths and file permissions
678718

679719
You can project keys to specific paths and specific permissions on a per-file
@@ -860,6 +900,23 @@ A container using a ConfigMap as a [subPath](/docs/concepts/storage/volumes/#usi
860900
{{< glossary_tooltip text="static pods" term_id="static-pod" >}}, because the
861901
kubelet does not support this.
862902

903+
## {{% heading "cleanup" %}}
904+
905+
Delete the ConfigMaps and Pods that you made:
906+
907+
```bash
908+
kubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \
909+
configmaps/game-config-env-file
910+
kubectl delete pod dapi-test-pod --now
911+
912+
# You might already have removed the next set
913+
kubectl delete configmaps/special-config configmaps/env-config
914+
kubectl delete configmap -l 'game-config in (config-4,config-5)’
915+
```
916+
917+
If you created a directory `configure-pod-container` and no longer need it, you should remove that too,
918+
or move it into the trash can / deleted files location.
919+
863920
864921
## {{% heading "whatsnext" %}}
865922

0 commit comments

Comments
 (0)