kube/secrets
This commit is contained in:
parent
2f235cd4d2
commit
f048e2e665
1 changed files with 90 additions and 2 deletions
|
@ -411,8 +411,8 @@ Pod YAML configurations
|
|||
- name: my-container
|
||||
image: my-image
|
||||
volumeMounts:
|
||||
- name: my-volumemounts
|
||||
mountPath: /etc/my-volumemounts.txt
|
||||
- name: my-volume
|
||||
mountPath: /var/lib/my-volume
|
||||
volumes:
|
||||
- name: my-volume
|
||||
configMap:
|
||||
|
@ -448,3 +448,91 @@ Pod YAML configurations
|
|||
envFrom:
|
||||
- configMapRef:
|
||||
name: my-configmap
|
||||
|
||||
Secrets
|
||||
=======
|
||||
|
||||
* generic
|
||||
* docker-registry
|
||||
* tls
|
||||
|
||||
From:
|
||||
|
||||
* environment variables file
|
||||
* file
|
||||
* key and value
|
||||
|
||||
Read
|
||||
----
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
get secrets \
|
||||
-n my-namespace
|
||||
|
||||
Write
|
||||
-----
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
create secret generic my-secret \
|
||||
--from-literal 'username=user' \
|
||||
--from-literal 'password=1234' \
|
||||
-n my-namespace
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
create secret generic my-secret \
|
||||
--from-file 'my-secret.txt' \
|
||||
-n my-namespace
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
create secret generic my-secret \
|
||||
--from-env-file 'my-secret.env' \
|
||||
-n my-namespace
|
||||
|
||||
.. code:: shell
|
||||
|
||||
kubectl \
|
||||
delete secret my-secret \
|
||||
-n my-namespace
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: my-pod
|
||||
spec:
|
||||
containers:
|
||||
- name: my-container
|
||||
image: my-image
|
||||
volumeMounts:
|
||||
- name: my-secret-volume
|
||||
mountPath: /var/lib/my-secret-volume
|
||||
volumes:
|
||||
- name: my-secret-volume
|
||||
secret:
|
||||
secretName: my-secret
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: my-pod
|
||||
spec:
|
||||
containers:
|
||||
- name: my-container
|
||||
image: my-image
|
||||
env:
|
||||
- name: username
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: username
|
||||
key: username
|
||||
|
|
Loading…
Reference in a new issue