kube/configmaps

This commit is contained in:
Marc Beninca 2023-07-10 15:18:56 +00:00
parent 9872f2d6ff
commit 377b3be9d8

View file

@ -339,3 +339,110 @@ Write
kubectl \
delete cronjob my-cronjob \
-n my-namespace
ConfigMaps
==========
From:
* environment variables file
* file
* key and value
Read
----
.. code:: shell
kubectl \
get configmap \
-n my-namespace
.. code:: shell
kubectl \
get configmap my-configmap \
-o yaml \
-n my-namespace
Write
-----
.. code:: shell
kubectl \
create configmap my-configmap \
--from-literal 'uid=1000' \
-n my-namespace
.. code:: shell
kubectl \
create configmap my-configmap \
--from-file 'my-configmap.txt' \
-n my-namespace
.. code:: shell
kubectl \
create configmap my-configmap \
--from-env-file 'my-configmap.env' \
-n my-namespace
.. code:: shell
kubectl \
delete configmap my-configmap \
-n my-namespace
Pod YAML configurations
^^^^^^^^^^^^^^^^^^^^^^^
.. code:: yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: my-image
volumeMounts:
- name: my-volumemounts
mountPath: /etc/my-volumemounts.txt
volumes:
- name: my-volume
configMap:
name: my-configmap
.. code:: yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: my-image
env:
- name: my-env
valueFrom:
configMapKeyRef:
name: my-configmap
key: my-key
.. code:: yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: my-image
envFrom:
- configMapRef:
name: my-configmap