Updated the numbering of instructions (#10401)

* Updated the numbering of instructions

All of the instructions were numbered like this:
1. do something
1. then do this
1. finally, do this.

I just changed them accordingly to be 1-2-3. There was also a case typo in the `LOG_LEVEL=info` which should be `LOG_LEVEL=INFO` based on the data in the yaml file.

* Update numbered list formatting

* [WIP] test snippet fix

* more numbered list/snippet fixes
This commit is contained in:
Lee Gaines
2018-10-25 14:08:57 -07:00
committed by k8s-ci-robot
parent 6a812006f0
commit 65eac71489
@@ -297,130 +297,130 @@ metadata:
### Define a container environment variable with data from a single ConfigMap ### Define a container environment variable with data from a single ConfigMap
1. Define an environment variable as a key-value pair in a ConfigMap: 1. Define an environment variable as a key-value pair in a ConfigMap:
```shell ```shell
kubectl create configmap special-config --from-literal=special.how=very kubectl create configmap special-config --from-literal=special.how=very
``` ```
1. Assign the `special.how` value defined in the ConfigMap to the `SPECIAL_LEVEL_KEY` environment variable in the Pod specification. 1. Assign the `special.how` value defined in the ConfigMap to the `SPECIAL_LEVEL_KEY` environment variable in the Pod specification.
```shell ```shell
kubectl edit pod dapi-test-pod kubectl edit pod dapi-test-pod
``` ```
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: dapi-test-pod name: dapi-test-pod
spec: spec:
containers: containers:
- name: test-container - name: test-container
image: k8s.gcr.io/busybox image: k8s.gcr.io/busybox
command: [ "/bin/sh", "-c", "env" ] command: [ "/bin/sh", "-c", "env" ]
env: env:
# Define the environment variable # Define the environment variable
- name: SPECIAL_LEVEL_KEY - name: SPECIAL_LEVEL_KEY
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
# The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY
name: special-config name: special-config
# Specify the key associated with the value # Specify the key associated with the value
key: special.how key: special.how
restartPolicy: Never restartPolicy: Never
``` ```
1. Save the changes to the Pod specification. Now, the Pod's output includes `SPECIAL_LEVEL_KEY=very`. 1. Save the changes to the Pod specification. Now, the Pod's output includes `SPECIAL_LEVEL_KEY=very`.
### Define container environment variables with data from multiple ConfigMaps ### Define container environment variables with data from multiple ConfigMaps
1. As with the previous example, create the ConfigMaps first. 1. As with the previous example, create the ConfigMaps first.
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: special-config name: special-config
namespace: default namespace: default
data: data:
special.how: very special.how: very
``` ```
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: env-config name: env-config
namespace: default namespace: default
data: data:
log_level: INFO log_level: INFO
``` ```
1. Define the environment variables in the Pod specification. 1. Define the environment variables in the Pod specification.
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: dapi-test-pod name: dapi-test-pod
spec: spec:
containers: containers:
- name: test-container - name: test-container
image: k8s.gcr.io/busybox image: k8s.gcr.io/busybox
command: [ "/bin/sh", "-c", "env" ] command: [ "/bin/sh", "-c", "env" ]
env: env:
- name: SPECIAL_LEVEL_KEY - name: SPECIAL_LEVEL_KEY
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: special-config name: special-config
key: special.how key: special.how
- name: LOG_LEVEL - name: LOG_LEVEL
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: env-config name: env-config
key: log_level key: log_level
restartPolicy: Never restartPolicy: Never
``` ```
1. Save the changes to the Pod specification. Now, the Pod's output includes `SPECIAL_LEVEL_KEY=very` and `LOG_LEVEL=info`. 1. Save the changes to the Pod specification. Now, the Pod's output includes `SPECIAL_LEVEL_KEY=very` and `LOG_LEVEL=INFO`.
## Configure all key-value pairs in a ConfigMap as container environment variables ## Configure all key-value pairs in a ConfigMap as container environment variables
{{< note >}} {{< note >}}
**Note:** This functionality is available to users running Kubernetes v1.6 and later. **Note:** This functionality is available in Kubernetes v1.6 and later.
{{< /note >}} {{< /note >}}
1. Create a ConfigMap containing multiple key-value pairs. 1. Create a ConfigMap containing multiple key-value pairs.
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: special-config name: special-config
namespace: default namespace: default
data: data:
SPECIAL_LEVEL: very SPECIAL_LEVEL: very
SPECIAL_TYPE: charm SPECIAL_TYPE: charm
``` ```
1. Use `envFrom` to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod. 1. Use `envFrom` to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: dapi-test-pod name: dapi-test-pod
spec: spec:
containers: containers:
- name: test-container - name: test-container
image: k8s.gcr.io/busybox image: k8s.gcr.io/busybox
command: [ "/bin/sh", "-c", "env" ] command: [ "/bin/sh", "-c", "env" ]
envFrom: envFrom:
- configMapRef: - configMapRef:
name: special-config name: special-config
restartPolicy: Never restartPolicy: Never
``` ```
1. Save the changes to the Pod specification. Now, the Pod's output includes `SPECIAL_LEVEL=very` and `SPECIAL_TYPE=charm`. 1. Save the changes to the Pod specification. Now, the Pod's output includes `SPECIAL_LEVEL=very` and `SPECIAL_TYPE=charm`.
@@ -602,9 +602,9 @@ data:
### Restrictions ### Restrictions
1. You must create a ConfigMap before referencing it in a Pod specification (unless you mark the ConfigMap as "optional"). If you reference a ConfigMap that doesn't exist, the Pod won't start. Likewise, references to keys that don't exist in the ConfigMap will prevent the pod from starting. - You must create a ConfigMap before referencing it in a Pod specification (unless you mark the ConfigMap as "optional"). If you reference a ConfigMap that doesn't exist, the Pod won't start. Likewise, references to keys that don't exist in the ConfigMap will prevent the pod from starting.
1. If you use `envFrom` to define environment variables from ConfigMaps, keys that are considered invalid will be skipped. The pod will be allowed to start, but the invalid names will be recorded in the event log (`InvalidVariableNames`). The log message lists each skipped key. For example: - If you use `envFrom` to define environment variables from ConfigMaps, keys that are considered invalid will be skipped. The pod will be allowed to start, but the invalid names will be recorded in the event log (`InvalidVariableNames`). The log message lists each skipped key. For example:
```shell ```shell
kubectl get events kubectl get events
@@ -612,9 +612,9 @@ data:
0s 0s 1 dapi-test-pod Pod Warning InvalidEnvironmentVariableNames {kubelet, 127.0.0.1} Keys [1badkey, 2alsobad] from the EnvFrom configMap default/myconfig were skipped since they are considered invalid environment variable names. 0s 0s 1 dapi-test-pod Pod Warning InvalidEnvironmentVariableNames {kubelet, 127.0.0.1} Keys [1badkey, 2alsobad] from the EnvFrom configMap default/myconfig were skipped since they are considered invalid environment variable names.
``` ```
1. ConfigMaps reside in a specific [namespace](/docs/concepts/overview/working-with-objects/namespaces/). A ConfigMap can only be referenced by pods residing in the same namespace. - ConfigMaps reside in a specific [namespace](/docs/concepts/overview/working-with-objects/namespaces/). A ConfigMap can only be referenced by pods residing in the same namespace.
1. Kubelet doesn't support the use of ConfigMaps for pods not found on the API server. - Kubelet doesn't support the use of ConfigMaps for pods not found on the API server.
This includes pods created via the Kubelet's --manifest-url flag, --config flag, or the Kubelet REST API. This includes pods created via the Kubelet's --manifest-url flag, --config flag, or the Kubelet REST API.
{{< note >}} {{< note >}}