Skip to content

Commit d34ee98

Browse files
author
Tim Bannister
committed
Tweak node capacity overprovisioning task
1 parent f8a3bb1 commit d34ee98

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

Diff for: content/en/docs/tasks/administer-cluster/node-overprovisioning.md

+34-13
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
---
2-
title: Overprovision Node Capacity For A Cluster
2+
title: Overprovision Node Capacity For A Cluster
33
content_type: task
44
weight: 10
55
---
66

77

88
<!-- overview -->
99

10-
This page guides you through configuring {{< glossary_tooltip text="Node" term_id="node" >}} overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively reserves a portion of your cluster's compute resources. This reservation helps reduce the time required to schedule new pods during scaling events, enhancing your cluster's responsiveness to sudden spikes in traffic or workload demands.
10+
This page guides you through configuring {{< glossary_tooltip text="Node" term_id="node" >}}
11+
overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively
12+
reserves a portion of your cluster's compute resources. This reservation helps reduce the time
13+
required to schedule new pods during scaling events, enhancing your cluster's responsiveness
14+
to sudden spikes in traffic or workload demands.
1115

12-
By maintaining some unused capacity, you ensure that resources are immediately available when new pods are created, preventing them from entering a pending state while the cluster scales up.
16+
By maintaining some unused capacity, you ensure that resources are immediately available when
17+
new pods are created, preventing them from entering a pending state while the cluster scales up.
1318

1419
## {{% heading "prerequisites" %}}
1520

16-
- You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with
21+
- You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with
1722
your cluster.
1823
- You should already have a basic understanding of
1924
[Deployments](/docs/concepts/workloads/controllers/deployment/),
20-
Pod {{<glossary_tooltip text="priority" term_id="pod-priority">}},
21-
and [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass).
25+
Pod {{< glossary_tooltip text="priority" term_id="pod-priority" >}},
26+
and {{< glossary_tooltip text="PriorityClasses" term_id="priority-class" >}}.
2227
- Your cluster must be set up with an [autoscaler](/docs/concepts/cluster-administration/cluster-autoscaling/)
2328
that manages nodes based on demand.
2429

2530
<!-- steps -->
2631

27-
## Create a placeholder Deployment
32+
## Create a PriorityClass
2833

2934
Begin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a
3035
negative priority value, that you will shortly assign to the placeholder pods.
@@ -43,14 +48,24 @@ When you add this to your cluster, Kubernetes runs those placeholder pods to res
4348
is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to
4449
{{< glossary_tooltip text="preempt" term_id="preemption" >}}.
4550

51+
## Run Pods that request node capacity
52+
4653
Review the sample manifest:
4754

4855
{{% code_sample language="yaml" file="deployments/deployment-with-capacity-reservation.yaml" %}}
4956

57+
### Pick a namespace for the placeholder pods
58+
59+
You should select, or create, a {{< glossary_tooltip term_id="namespace" text="namespace">}}
60+
that the placeholder Pods will go into.
61+
62+
### Create the placeholder deployment
63+
5064
Create a Deployment based on that manifest:
5165

5266
```shell
53-
kubectl apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml
67+
# Change the namespace name "example"
68+
kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml
5469
```
5570

5671
## Adjust placeholder resource requests
@@ -61,7 +76,13 @@ To edit the Deployment, modify the `resources` section in the Deployment manifes
6176
to set appropriate requests and limits. You can download that file locally and then edit it
6277
with whichever text editor you prefer.
6378

64-
For example, to reserve 500m CPU and 1Gi memory across 5 placeholder pods,
79+
You can also edit the Deployment using kubectl:
80+
81+
```shell
82+
kubectl edit deployment capacity-reservation
83+
```
84+
85+
For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods,
6586
define the resource requests and limits for a single placeholder pod as follows:
6687

6788
```yaml
@@ -77,10 +98,10 @@ define the resource requests and limits for a single placeholder pod as follows:
7798
7899
### Calculate the total reserved resources
79100
80-
For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory:
81-
82-
Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`)
83-
Total Memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`)
101+
<!-- trailing whitespace in next paragraph is significant -->
102+
For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory:
103+
Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`)
104+
Total memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`)
84105

85106
To scale the Deployment, adjust the number of replicas based on your cluster's size and expected workload:
86107

Diff for: content/en/examples/deployments/deployment-with-capacity-reservation.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: capacity-reservation
5+
# You should decide what namespace to deploy this into
56
spec:
67
replicas: 1
78
selector:
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: scheduling.k8s.io/v1
22
kind: PriorityClass
33
metadata:
4-
name: placeholder
4+
name: placeholder # these Pods represent placeholder capacity
55
value: -1000
66
globalDefault: false
77
description: "Negative priority for placeholder pods to enable overprovisioning."

0 commit comments

Comments
 (0)