Skip to content

Commit

Permalink
Consolidate YAML files [part-10] (#9362)
Browse files Browse the repository at this point in the history
* Consolidate YAML files [part-10]

This PR relocates the YAML files used by the pod configuration topic.

* Update examples_test.go

* Update examples_test.go

* Update examples_test.go

* Update examples_test.go

* Update examples_test.go
  • Loading branch information
tengqm authored and k8s-ci-robot committed Jul 3, 2018
1 parent 0f5f027 commit 9b81aa7
Show file tree
Hide file tree
Showing 43 changed files with 140 additions and 153 deletions.
Expand Up @@ -71,15 +71,15 @@ In this exercise, you create a Pod that has one Container. The Container has a C
request of 0.5 cpu and a CPU limit of 1 cpu. Here's the configuration file
for the Pod:

{{< code file="cpu-request-limit.yaml" >}}
{{< codenew file="pods/resource/cpu-request-limit.yaml" >}}

In the configuration file, the `args` section provides arguments for the Container when it starts.
The `-cpus "2"` argument tells the Container to attempt to use 2 cpus.

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/cpu-request-limit.yaml --namespace=cpu-example
kubectl create -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example
```

Verify that the Pod's Container is running:
Expand Down Expand Up @@ -167,12 +167,12 @@ the capacity of any Node in your cluster. Here is the configuration file for a P
that has one Container. The Container requests 100 cpu, which is likely to exceed the
capacity of any Node in your cluster.

{{< code file="cpu-request-limit-2.yaml" >}}
{{< codenew file="pods/resource/cpu-request-limit-2.yaml" >}}

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/cpu-request-limit-2.yaml --namespace=cpu-example
kubectl create -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example
```

View the Pod's status:
Expand Down
Expand Up @@ -71,15 +71,15 @@ In this exercise, you create a Pod that has one Container. The Container has a m
request of 100 MiB and a memory limit of 200 MiB. Here's the configuration file
for the Pod:

{{< code file="memory-request-limit.yaml" >}}
{{< codenew file="pods/resource/memory-request-limit.yaml" >}}

In the configuration file, the `args` section provides arguments for the Container when it starts.
The `"--vm-bytes", "150M"` arguments tell the Container to attempt to allocate 150 MiB of memory.

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/memory-request-limit.yaml --namespace=mem-example
kubectl create -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example
```

Verify that the Pod's Container is running:
Expand Down Expand Up @@ -142,15 +142,15 @@ In this exercise, you create a Pod that attempts to allocate more memory than it
Here is the configuration file for a Pod that has one Container. The Container has a
memory request of 50 MiB and a memory limit of 100 MiB.

{{< code file="memory-request-limit-2.yaml" >}}
{{< codenew file="pods/resource/memory-request-limit-2.yaml" >}}

In the configuration file, in the `args` section, you can see that the Container
will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/memory-request-limit-2.yaml --namespace=mem-example
kubectl create -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example
```

View detailed information about the Pod:
Expand Down Expand Up @@ -253,12 +253,12 @@ capacity of any Node in your cluster. Here is the configuration file for a Pod t
Container. The Container requests 1000 GiB of memory, which is likely to exceed the capacity
of any Node in your cluster.

{{< code file="memory-request-limit-3.yaml" >}}
{{< codenew file="pods/resource/memory-request-limit-3.yaml" >}}

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/memory-request-limit-3.yaml --namespace=mem-example
kubectl create -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example
```

View the Pod's status:
Expand Down
Expand Up @@ -30,15 +30,15 @@ for the postStart and preStop events.

Here is the configuration file for the Pod:

{{< code file="lifecycle-events.yaml" >}}
{{< codenew file="pods/lifecycle-events.yaml" >}}

In the configuration file, you can see that the postStart command writes a `message`
file to the Container's `/usr/share` directory. The preStop command shuts down
nginx gracefully. This is helpful if the Container is being terminated because of a failure.

Create the Pod:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/lifecycle-events.yaml
kubectl create -f https://k8s.io/examples/pods/lifecycle-events.yaml

Verify that the Container in the Pod is running:

Expand Down
Expand Up @@ -38,7 +38,7 @@ liveness probes to detect and remedy such situations.
In this exercise, you create a Pod that runs a Container based on the
`k8s.gcr.io/busybox` image. Here is the configuration file for the Pod:

{{< code file="exec-liveness.yaml" >}}
{{< codenew file="pods/probe/exec-liveness.yaml" >}}

In the configuration file, you can see that the Pod has a single Container.
The `periodSeconds` field specifies that the kubelet should perform a liveness
Expand All @@ -62,7 +62,7 @@ code. After 30 seconds, `cat /tmp/healthy` returns a failure code.
Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/exec-liveness.yaml
kubectl create -f https://k8s.io/examples/pods/probe/exec-liveness.yaml
```

Within 30 seconds, view the Pod events:
Expand Down Expand Up @@ -122,7 +122,7 @@ Another kind of liveness probe uses an HTTP GET request. Here is the configurati
file for a Pod that runs a container based on the `k8s.gcr.io/liveness`
image.
{{< code file="http-liveness.yaml" >}}
{{< codenew file="pods/probe/http-liveness.yaml" >}}
In the configuration file, you can see that the Pod has a single Container.
The `periodSeconds` field specifies that the kubelet should perform a liveness
Expand Down Expand Up @@ -163,7 +163,7 @@ checks will fail, and the kubelet will kill and restart the Container.
To try the HTTP liveness check, create a Pod:
```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/http-liveness.yaml
kubectl create -f https://k8s.io/examples/pods/probe/http-liveness.yaml
```
After 10 seconds, view Pod events to verify that liveness probes have failed and
Expand All @@ -180,7 +180,7 @@ kubelet will attempt to open a socket to your container on the specified port.
If it can establish a connection, the container is considered healthy, if it
can’t it is considered a failure.
{{< code file="tcp-liveness-readiness.yaml" >}}
{{< codenew file="pods/probe/tcp-liveness-readiness.yaml" >}}
As you can see, configuration for a TCP check is quite similar to an HTTP check.
This example uses both readiness and liveness probes. The kubelet will send the
Expand All @@ -198,7 +198,7 @@ will be restarted.
To try the TCP liveness check, create a Pod:
```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/tcp-liveness-readiness.yaml
kubectl create -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml
```
After 15 seconds, view Pod events to verify that liveness probes:
Expand Down
Expand Up @@ -62,7 +62,7 @@ to set up

Here is the configuration file for the hostPath PersistentVolume:

{{< code file="task-pv-volume.yaml" >}}
{{< codenew file="pods/storage/pv-volume.yaml" >}}

The configuration file specifies that the volume is at `/mnt/data` on the
cluster's Node. The configuration also specifies a size of 10 gibibytes and
Expand All @@ -73,7 +73,7 @@ PersistentVolumeClaim requests to this PersistentVolume.

Create the PersistentVolume:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/task-pv-volume.yaml
kubectl create -f https://k8s.io/examples/pods/storage/pv-volume.yaml

View information about the PersistentVolume:

Expand All @@ -94,11 +94,11 @@ access for at least one Node.

Here is the configuration file for the PersistentVolumeClaim:

{{< code file="task-pv-claim.yaml" >}}
{{< codenew file="pods/storage/pv-claim.yaml" >}}

Create the PersistentVolumeClaim:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/task-pv-claim.yaml
kubectl create -f https://k8s.io/examples/pods/storage/pv-claim.yaml

After you create the PersistentVolumeClaim, the Kubernetes control plane looks
for a PersistentVolume that satisfies the claim's requirements. If the control
Expand Down Expand Up @@ -130,15 +130,15 @@ The next step is to create a Pod that uses your PersistentVolumeClaim as a volum

Here is the configuration file for the Pod:

{{< code file="task-pv-pod.yaml" >}}
{{< codenew file="pods/storage/pv-pod.yaml" >}}

Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but
it does not specify a PersistentVolume. From the Pod's point of view, the claim
is a volume.

Create the Pod:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/task-pv-pod.yaml
kubectl create -f https://k8s.io/examples/pods/storage/pv-pod.yaml

Verify that the Container in the Pod is running;

Expand Down
Expand Up @@ -26,7 +26,7 @@ container starts.

Here is the configuration file for the Pod:

{{< code file="init-containers.yaml" >}}
{{< codenew file="pods/init-containers.yaml" >}}

In the configuration file, you can see that the Pod has a Volume that the init
container and the application container share.
Expand All @@ -43,7 +43,7 @@ of the nginx server.

Create the Pod:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/init-containers.yaml
kubectl create -f https://k8s.io/examples/pods/init-containers.yaml

Verify that the nginx container is running:

Expand Down
Expand Up @@ -28,7 +28,7 @@ In this exercise, you create username and password Secrets from local files. You

Here is the configuration file for the Pod:

{{< code file="projected-volume.yaml" >}}
{{< codenew file="pods/storage/projected.yaml" >}}

1. Create the Secrets:
```shell
Expand All @@ -42,7 +42,7 @@ Here is the configuration file for the Pod:
```
1. Create the Pod:
```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/projected-volume.yaml
kubectl create -f https://k8s.io/examples/pods/storage/projected.yaml
```
1. Verify that the Pod's Container is running, and then watch for changes to
the Pod:
Expand Down
Expand Up @@ -33,11 +33,11 @@ Volume of type
that lasts for the life of the Pod, even if the Container terminates and
restarts. Here is the configuration file for the Pod:

{{< code file="pod-redis.yaml" >}}
{{< codenew file="pods/storage/redis.yaml" >}}

1. Create the Pod:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/pod-redis.yaml
kubectl create -f https://k8s.io/examples/pods/storage/redis.yaml

1. Verify that the Pod's Container is running, and then watch for changes to
the Pod:
Expand Down
Expand Up @@ -36,14 +36,14 @@ descriptive resource name.

Here is the configuration file for a Pod that has one Container:

{{< code file="extended-resource-pod.yaml" >}}
{{< codenew file="pods/resource/extended-resource-pod.yaml" >}}

In the configuration file, you can see that the Container requests 3 dongles.

Create a Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/extended-resource-pod.yaml
kubectl create -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml
```

Verify that the Pod is running:
Expand Down Expand Up @@ -72,15 +72,15 @@ Requests:
Here is the configuration file for a Pod that has one Container. The Container requests
two dongles.

{{< code file="extended-resource-pod-2.yaml" >}}
{{< codenew file="pods/resource/extended-resource-pod-2.yaml" >}}

Kubernetes will not be able to satisfy the request for two dongles, because the first Pod
used three of the four available dongles.

Attempt to create a Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/extended-resource-pod-2.yaml
kubectl create -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml
```

Describe the Pod
Expand Down
11 changes: 0 additions & 11 deletions content/en/docs/tasks/configure-pod-container/mem-limit-range.yaml

This file was deleted.

Expand Up @@ -112,11 +112,11 @@ You have successfully set your Docker credentials as a Secret called `regcred` i

Here is a configuration file for a Pod that needs access to your Docker credentials in `regcred`:

{{< code file="private-reg-pod.yaml" >}}
{{< codenew file="pods/private-reg-pod.yaml" >}}

Download the above file:

wget -O my-private-reg-pod.yaml https://k8s.io/docs/tasks/configure-pod-container/private-reg-pod.yaml
wget -O my-private-reg-pod.yaml https://k8s.io/examples/pods/private-reg-pod.yaml

In file `my-private-reg-pod.yaml`, replace `<your-private-image>` with the path to an image in a private registry such as:

Expand All @@ -142,4 +142,3 @@ Create a Pod that uses your Secret, and verify that the Pod is running:

{{% /capture %}}


Expand Up @@ -50,12 +50,12 @@ For a Pod to be given a QoS class of Guaranteed:
Here is the configuration file for a Pod that has one Container. The Container has a memory limit and a
memory request, both equal to 200 MiB. The Container has a cpu limit and a cpu request, both equal to 700 millicpu:

{{< code file="qos-pod.yaml" >}}
{{< codenew file="pods/qos/qos-pod.yaml" >}}

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/qos-pod.yaml --namespace=qos-example
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example
```

View detailed information about the Pod:
Expand Down Expand Up @@ -106,12 +106,12 @@ A Pod is given a QoS class of Burstable if:
Here is the configuration file for a Pod that has one Container. The Container has a memory limit of 200 MiB
and a memory request of 100 MiB.

{{< code file="qos-pod-2.yaml" >}}
{{< codenew file="pods/qos/qos-pod-2.yaml" >}}

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/qos-pod-2.yaml --namespace=qos-example
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example
```

View detailed information about the Pod:
Expand Down Expand Up @@ -151,12 +151,12 @@ have any memory or cpu limits or requests.
Here is the configuration file for a Pod that has one Container. The Container has no memory or cpu
limits or requests:

{{< code file="qos-pod-3.yaml" >}}
{{< codenew file="pods/qos/qos-pod-3.yaml" >}}

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/qos-pod-3.yaml --namespace=qos-example
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example
```

View detailed information about the Pod:
Expand Down Expand Up @@ -187,15 +187,15 @@ kubectl delete pod qos-demo-3 --namespace=qos-example
Here is the configuration file for a Pod that has two Containers. One container specifies a memory
request of 200 MiB. The other Container does not specify any requests or limits.

{{< code file="qos-pod-4.yaml" >}}
{{< codenew file="pods/qos/qos-pod-4.yaml" >}}

Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the
criteria for QoS class Guaranteed, and one of its Containers has a memory request.

Create the Pod:

```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/qos-pod-4.yaml --namespace=qos-example
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example
```

View detailed information about the Pod:
Expand Down

This file was deleted.

0 comments on commit 9b81aa7

Please sign in to comment.