Update code render and format auto-generate list (#9070)

* Update the code render

* Update the generate catalog and formate code rendering

* Fix heading levels for template
This commit is contained in:
Gao Wen
2018-08-22 03:13:09 +08:00
committed by k8s-ci-robot
parent a3db9fb85d
commit 93b544505d
2 changed files with 67 additions and 48 deletions
@@ -39,8 +39,15 @@ username and password:
1. Create the Secret
kubectl create -f https://k8s.io/examples/pods/inject/secret.yaml
```shell
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/secret.yaml
```
{{< note >}}
**Note:** If you want to skip the Base64 encoding step, you can create a Secret by using the `kubectl create secret` command:
{{< /note >}}
```shell
kubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'
```
1. View information about the Secret:
@@ -88,44 +95,52 @@ Here is a configuration file you can use to create a Pod:
1. Create the Pod:
kubectl create -f https://k8s.io/examples/pods/inject/secret-pod.yaml
```shell
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/secret-pod.yaml
```
1. Verify that your Pod is running:
kubectl get pod secret-test-pod
```shell
kubectl get pod secret-test-pod
```
Output:
NAME READY STATUS RESTARTS AGE
secret-test-pod 1/1 Running 0 42m
```shell
NAME READY STATUS RESTARTS AGE
secret-test-pod 1/1 Running 0 42m
```
1. Get a shell into the Container that is running in your Pod:
kubectl exec -it secret-test-pod -- /bin/bash
```shell
kubectl exec -it secret-test-pod -- /bin/bash
```
1. The secret data is exposed to the Container through a Volume mounted under
`/etc/secret-volume`. In your shell, go to the directory where the secret data
is exposed:
root@secret-test-pod:/# cd /etc/secret-volume
```shell
root@secret-test-pod:/# cd /etc/secret-volume
```
1. In your shell, list the files in the `/etc/secret-volume` directory:
root@secret-test-pod:/etc/secret-volume# ls
```shell
root@secret-test-pod:/etc/secret-volume# ls
```
The output shows two files, one for each piece of secret data:
password username
```shell
password username
```
1. In your shell, display the contents of the `username` and `password` files:
root@secret-test-pod:/etc/secret-volume# cat username; echo; cat password; echo
```shell
root@secret-test-pod:/etc/secret-volume# cat username; echo; cat password; echo
```
The output is your username and password:
my-app
39528$vdg7Jb
```shell
my-app
39528$vdg7Jb
```
## Create a Pod that has access to the secret data through environment variables
@@ -135,32 +150,39 @@ Here is a configuration file you can use to create a Pod:
1. Create the Pod:
kubectl create -f https://k8s.io/examples/pods/inject/secret-envars-pod.yaml
```shell
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/secret-envars-pod.yaml
```
1. Verify that your Pod is running:
kubectl get pod secret-envars-test-pod
```shell
kubectl get pod secret-envars-test-pod
```
Output:
NAME READY STATUS RESTARTS AGE
secret-envars-test-pod 1/1 Running 0 4m
```shell
NAME READY STATUS RESTARTS AGE
secret-envars-test-pod 1/1 Running 0 4m
```
1. Get a shell into the Container that is running in your Pod:
kubectl exec -it secret-envars-test-pod -- /bin/bash
```shell
kubectl exec -it secret-envars-test-pod -- /bin/bash
```
1. In your shell, display the environment variables:
root@secret-envars-test-pod:/# printenv
```shell
root@secret-envars-test-pod:/# printenv
```
The output includes your username and password:
...
SECRET_USERNAME=my-app
...
SECRET_PASSWORD=39528$vdg7Jb
```shell
...
SECRET_USERNAME=my-app
...
SECRET_PASSWORD=39528$vdg7Jb
```
{{% /capture %}}
{{% capture whatsnext %}}
@@ -8,14 +8,12 @@ weight: 60
{{% capture overview %}}
You can use a `podpreset` object to inject information like secrets, volume
You can use a `PodPreset` object to inject information like secrets, volume
mounts, and environment variables etc into pods at creation time.
This task shows some examples on using the `PodPreset` resource.
{{% /capture %}}
{{< toc >}}
{{% capture prerequisites %}}
Get an overview of PodPresets at
@@ -27,9 +25,8 @@ Get an overview of PodPresets at
{{% capture steps %}}
## Create a Pod Preset
### Simple Pod Spec Example
## Simple Pod Spec Example
This is a simple example to show how a Pod spec is modified by the Pod
Preset.
@@ -78,7 +75,7 @@ To see above output, run the following command:
$ kubectl get pod website -o yaml
```
### Pod Spec with `ConfigMap` Example
## Pod Spec with ConfigMap Example
This is an example to show how a Pod spec is modified by the Pod Preset
that defines a `ConfigMap` for Environment Variables.
@@ -99,7 +96,7 @@ that defines a `ConfigMap` for Environment Variables.
{{< codenew file="podpreset/allow-db-merged.yaml" >}}
### ReplicaSet with Pod Spec Example
## ReplicaSet with Pod Spec Example
The following example shows that only the pod spec is modified by the Pod
Preset.
@@ -119,7 +116,7 @@ to validate that the PodPreset has been applied.
{{< codenew file="podpreset/replicaset-merged.yaml" >}}
### Multiple PodPreset Example
## Multiple PodPreset Example
This is an example to show how a Pod spec is modified by multiple Pod
Injection Policies.
@@ -140,7 +137,7 @@ Injection Policies.
{{< codenew file="podpreset/multi-merged.yaml" >}}
### Conflict Example
## Conflict Example
This is an example to show how a Pod spec is not modified by the Pod Preset
when there is a conflict.