Merge branch 'master' into turn-tear
This commit is contained in:
commit
e7eb93aaf4
|
@ -12,6 +12,8 @@ toc:
|
|||
path: https://github.com/kubernetes/kubernetes/tree/release-1.3/examples/rbd/
|
||||
- title: CephFS
|
||||
path: https://github.com/kubernetes/kubernetes/tree/release-1.3/examples/cephfs/
|
||||
- title: CockroachDB
|
||||
path: https://github.com/kubernetes/kubernetes/tree/release-1.4/examples/cockroachdb/
|
||||
- title: GlusterFS
|
||||
path: https://github.com/kubernetes/kubernetes/tree/release-1.3/examples/glusterfs/
|
||||
- title: Hazelcast
|
||||
|
|
|
@ -8,6 +8,8 @@ toc:
|
|||
path: /docs/tasks/configure-pod-container/define-environment-variable-container/
|
||||
- title: Defining a Command and Arguments for a Container
|
||||
path: /docs/tasks/configure-pod-container/define-command-argument-container/
|
||||
- title: Assigning CPU and RAM Resources to a Container
|
||||
path: /docs/tasks/configure-pod-container/assign-cpu-ram-container/
|
||||
- title: Accessing Applications in a Cluster
|
||||
section:
|
||||
- title: Using Port Forwarding to Access Applications in a Cluster
|
||||
|
|
|
@ -34,7 +34,7 @@ orchestration system (e.g. Puppet) that you have to integrate with.
|
|||
If you are not constrained, other tools build on kubeadm to give you complete clusters:
|
||||
|
||||
* On GCE, [Google Container Engine](https://cloud.google.com/container-engine/) gives you turn-key Kubernetes
|
||||
* On AWS, [kops](kops) makes installation and cluster management easy (and supports high availability)
|
||||
* On AWS, [kops](https://github.com/kubernetes/kops) makes installation and cluster management easy (and supports high availability)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
---
|
||||
|
||||
{% capture overview %}
|
||||
|
||||
This page shows how assign CPU and RAM resources to containers running
|
||||
in a Kubernetes Pod.
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
|
||||
{% capture prerequisites %}
|
||||
|
||||
{% include task-tutorial-prereqs.md %}
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
|
||||
{% capture steps %}
|
||||
|
||||
### Assigning CPU and RAM resources to a container
|
||||
|
||||
When you create a Pod, you can request CPU and RAM resources for the containers
|
||||
that run in the Pod. You can also set limits for CPU and RAM resources. To
|
||||
request CPU and RAM resources, include the `resources:requests` field in the
|
||||
configuration file. To set limits on CPU and RAM resources, include the
|
||||
`resources:limits` field.
|
||||
|
||||
Kubernetes schedules a Pod to run on a Node only if the Node has enough CPU and
|
||||
RAM available to satisfy the total CPU and RAM requested by all of the
|
||||
containers in the Pod. Also, as a container runs on a Node, Kubernetes doesn't
|
||||
allow the CPU and RAM consumed by the container to exceed the limits you specify
|
||||
for the container. If a container exceeds its RAM limit, it is terminated. If a
|
||||
container exceeds its CPU limit, it becomes a candidate for having its CPU use
|
||||
throttled.
|
||||
|
||||
In this exercise, you create a Pod that runs one container. The configuration
|
||||
file for the Pod requests 250 milicpu and 64 mebibytes of RAM. It also sets
|
||||
upper limits of 1 cpu and 128 mebibytes of RAM. Here is the configuration file
|
||||
for the `Pod`:
|
||||
|
||||
{% include code.html language="yaml" file="cpu-ram.yaml" ghlink="/docs/tasks/configure-pod-container/cpu-ram.yaml" %}
|
||||
|
||||
1. Create a Pod based on the YAML configuration file:
|
||||
|
||||
export REPO=https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/master
|
||||
kubectl create -f $REPO/docs/tasks/configure-pod-container/cpu-ram.yaml
|
||||
|
||||
1. Display information about the pod:
|
||||
|
||||
kubectl describe pod cpu-ram-demo
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
Name: cpu-ram-demo
|
||||
...
|
||||
Containers:
|
||||
cpu-ram-demo-container:
|
||||
...
|
||||
Limits:
|
||||
cpu: 1
|
||||
memory: 128Mi
|
||||
Requests:
|
||||
cpu: 250m
|
||||
memory: 64Mi
|
||||
|
||||
### Understanding CPU and RAM units
|
||||
|
||||
The CPU resource is measured in *cpu*s. Fractional values are allowed. You can
|
||||
use the suffix *m* to mean mili. For example 100m cpu is 100 milicpu, and is
|
||||
the same as 0.1 cpu.
|
||||
|
||||
The RAM resource is measured in bytes. You can express RAM as a plain integer
|
||||
or a fixed-point integer with one of these suffixes: E, P, T, G, M, K, Ei, Pi,
|
||||
Ti, Gi, Mi, Ki. For example, the following represent approximately the same value:
|
||||
|
||||
128974848, 129e6, 129M , 123Mi
|
||||
|
||||
### If you don't specify limits or requests
|
||||
|
||||
If you don't specify a RAM limit, Kubernetes places no upper bound on the
|
||||
amount of RAM a Container can use. A Container could use all the RAM
|
||||
available on the Node where the Container is running. Similarly, if you don't
|
||||
specify a CPU limit, Kubernetes places no upper bound on CPU resources, and a
|
||||
Container could use all of the CPU resources available on the Node.
|
||||
|
||||
For information about why you would want to specify limits, see
|
||||
[Setting Pod CPU and Memory Limits](/docs/admin/limitrange/).
|
||||
|
||||
For information about what happens if you don't specify CPU and RAM requests, see
|
||||
[Resource Requests and Limits of Pod and Container](/docs/user-guide/compute-resources/).
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% capture whatsnext %}
|
||||
|
||||
* Learn more about [managing compute resources](/docs/user-guide/compute-resources/).
|
||||
* See [ResourceRequirements](/docs/api-reference/v1/definitions/#_v1_resourcerequirements).
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
|
||||
{% include templates/task.md %}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: cpu-ram-demo
|
||||
spec:
|
||||
containers:
|
||||
- name: cpu-ram-demo-container
|
||||
image: gcr.io/google-samples/node-hello:1.0
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "250m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "1"
|
|
@ -7,6 +7,7 @@ The Tasks section of the Kubernetes documentation is a work in progress
|
|||
|
||||
* [Defining Environment Variables for a Container](/docs/tasks/configure-pod-container/define-environment-variable-container/)
|
||||
* [Defining a Command and Arguments for a Container](/docs/tasks/configure-pod-container/define-command-argument-container/)
|
||||
* [Assigning CPU and RAM Resources to a Container](/docs/tasks/configure-pod-container/assign-cpu-ram-container/)
|
||||
|
||||
#### Accessing Applications in a Cluster
|
||||
|
||||
|
@ -23,5 +24,4 @@ The Tasks section of the Kubernetes documentation is a work in progress
|
|||
### What's next
|
||||
|
||||
If you would like to write a task page, see
|
||||
[Using Page Templates](/docs/contribute/page-templates/)
|
||||
for information about the task page type and the task template.
|
||||
[Creating a Documentation Pull Request](/docs/create-pull-request/).
|
||||
|
|
Loading…
Reference in New Issue