Skip to content

Commit 4bb4330

Browse files
charliedmcbCharlie McBride
andauthored
docs(workshop): add documentation for kubecon optional steps (#568)
* add documentation for kubecon optional steps * add additional notes on cleanup * add aks-node-viewer install * switch to getting latest * change to v0.0.2-alpha * tested through 12_scheduling_constraints * single areas clearly * updating docs removing termgraceseconds * modify comments * update comment on logs * update notes * remove , * cleanup wording * use correct karpenter-kct name * update note * minor rewording * add note * add a cd * add note about cleanup * update comment * reword * cleanup wording * reword tooling header * reword * add a * reword * rewording * reword --------- Co-authored-by: Charlie McBride <[email protected]>
1 parent 837329f commit 4bb4330

7 files changed

+409
-18
lines changed

docs/workshops/10_multi_node_consolidation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
## Deploy NodePool:
33

4-
Use the following command to deploy a `NodePool`, and `AKSNodeClass` for Multi Node Consolidation, where we've enabled consolidation for when nodes are empty or underutilized, immediately after `0s`.
4+
Use the following command to deploy a `NodePool`, and `AKSNodeClass` for `Multi Node Consolidation`, where we've enabled consolidation for when nodes are empty or underutilized, immediately after `0s`.
55

66
```bash
77
cd ~/environment/karpenter
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
2+
## Deploy NodePool:
3+
4+
### 2. Percentage-Base Disruption
5+
6+
Use the following command, instead of the NodePool deployment listed under `2. Percentage-Base Disruption` of `Scheduling Constraints`. This will deploy a `NodePool`, and `AKSNodeClass` where we've set a disruption budget of `40%`.
7+
8+
```bash
9+
cd ~/environment/karpenter
10+
cat > ndb-nodepool.yaml << EOF
11+
# This example NodePool will provision general purpose instances
12+
---
13+
apiVersion: karpenter.sh/v1
14+
kind: NodePool
15+
metadata:
16+
name: default
17+
annotations:
18+
kubernetes.io/description: "Basic NodePool for generic workloads"
19+
spec:
20+
disruption:
21+
consolidationPolicy: WhenEmptyOrUnderutilized
22+
consolidateAfter: 30s
23+
budgets:
24+
- nodes: "40%"
25+
limits:
26+
cpu: "20"
27+
template:
28+
metadata:
29+
labels:
30+
# required for Karpenter to predict overhead from cilium DaemonSet
31+
kubernetes.azure.com/ebpf-dataplane: cilium
32+
eks-immersion-team: my-team
33+
spec:
34+
expireAfter: 720h # 30 days
35+
startupTaints:
36+
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
37+
- key: node.cilium.io/agent-not-ready
38+
effect: NoExecute
39+
value: "true"
40+
requirements:
41+
- key: karpenter.azure.com/sku-family
42+
operator: In
43+
values: [D]
44+
- key: karpenter.azure.com/sku-cpu
45+
operator: Lt
46+
values: ["3"]
47+
- key: kubernetes.io/arch
48+
operator: In
49+
values: ["amd64"]
50+
- key: kubernetes.io/os
51+
operator: In
52+
values: ["linux"]
53+
- key: karpenter.sh/capacity-type
54+
operator: In
55+
values: ["on-demand"]
56+
nodeClassRef:
57+
group: karpenter.azure.com
58+
kind: AKSNodeClass
59+
name: default
60+
---
61+
apiVersion: karpenter.azure.com/v1alpha2
62+
kind: AKSNodeClass
63+
metadata:
64+
name: default
65+
annotations:
66+
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
67+
spec:
68+
imageFamily: Ubuntu2204
69+
EOF
70+
71+
kubectl apply -f ndb-nodepool.yaml
72+
```
73+
74+
```
75+
nodepool.karpenter.sh/default created
76+
aksnodeclass.karpenter.azure.com/default created
77+
```
78+
79+
### 3. Multiple Budget Policies
80+
81+
Use the following command, instead of the first NodePool deployment listed under `3. Multiple Budget Policies` of `Scheduling Constraints`. This will update the `NodePool` deployment to add a max disruption budget of `2`, and define a schedule for 3 hours currently set to start at 21:00 UTC (2:00PM PT) of `0` which when active will not allow for any disruption.
82+
83+
> Note: modify the schedule to the current UTC time, to see it take effect while completing this workshop
84+
85+
```bash
86+
cd ~/environment/karpenter
87+
cat > ndb-nodepool.yaml << EOF
88+
# This example NodePool will provision general purpose instances
89+
---
90+
apiVersion: karpenter.sh/v1
91+
kind: NodePool
92+
metadata:
93+
name: default
94+
annotations:
95+
kubernetes.io/description: "Basic NodePool for generic workloads"
96+
spec:
97+
disruption:
98+
consolidationPolicy: WhenEmptyOrUnderutilized
99+
consolidateAfter: 30s
100+
budgets:
101+
- nodes: "40%"
102+
reasons:
103+
- "Empty"
104+
- "Drifted"
105+
- nodes: "2"
106+
- nodes: "0"
107+
schedule: "0 21 * * *" # modify this line to the current UTC time
108+
duration: 3h
109+
limits:
110+
cpu: "40"
111+
template:
112+
metadata:
113+
labels:
114+
# required for Karpenter to predict overhead from cilium DaemonSet
115+
kubernetes.azure.com/ebpf-dataplane: cilium
116+
eks-immersion-team: my-team
117+
spec:
118+
expireAfter: 720h # 30 days
119+
startupTaints:
120+
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
121+
- key: node.cilium.io/agent-not-ready
122+
effect: NoExecute
123+
value: "true"
124+
requirements:
125+
- key: karpenter.azure.com/sku-family
126+
operator: In
127+
values: [D]
128+
- key: karpenter.azure.com/sku-cpu
129+
operator: Lt
130+
values: ["3"]
131+
- key: kubernetes.io/arch
132+
operator: In
133+
values: ["amd64"]
134+
- key: kubernetes.io/os
135+
operator: In
136+
values: ["linux"]
137+
- key: karpenter.sh/capacity-type
138+
operator: In
139+
values: ["on-demand"]
140+
nodeClassRef:
141+
group: karpenter.azure.com
142+
kind: AKSNodeClass
143+
name: default
144+
---
145+
apiVersion: karpenter.azure.com/v1alpha2
146+
kind: AKSNodeClass
147+
metadata:
148+
name: default
149+
annotations:
150+
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
151+
spec:
152+
imageFamily: Ubuntu2204
153+
EOF
154+
155+
kubectl apply -f ndb-nodepool.yaml
156+
```
157+
158+
```
159+
nodepool.karpenter.sh/default configured
160+
aksnodeclass.karpenter.azure.com/default unchanged
161+
```
162+
163+
Use the following command, instead of the second NodePool deployment listed under `3. Multiple Budget Policies` of `Scheduling Constraints`. This will remove the disruption schedule which is not allowing for any disruptions to occur.
164+
165+
```bash
166+
cd ~/environment/karpenter
167+
cat > ndb-nodepool.yaml << EOF
168+
# This example NodePool will provision general purpose instances
169+
---
170+
apiVersion: karpenter.sh/v1
171+
kind: NodePool
172+
metadata:
173+
name: default
174+
annotations:
175+
kubernetes.io/description: "Basic NodePool for generic workloads"
176+
spec:
177+
disruption:
178+
consolidationPolicy: WhenEmptyOrUnderutilized
179+
consolidateAfter: 30s
180+
budgets:
181+
- nodes: "40%"
182+
reasons:
183+
- "Empty"
184+
- "Drifted"
185+
- nodes: "2"
186+
limits:
187+
cpu: "10"
188+
template:
189+
metadata:
190+
labels:
191+
# required for Karpenter to predict overhead from cilium DaemonSet
192+
kubernetes.azure.com/ebpf-dataplane: cilium
193+
eks-immersion-team: my-team
194+
spec:
195+
expireAfter: 720h # 30 days
196+
startupTaints:
197+
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
198+
- key: node.cilium.io/agent-not-ready
199+
effect: NoExecute
200+
value: "true"
201+
requirements:
202+
- key: karpenter.azure.com/sku-family
203+
operator: In
204+
values: [D]
205+
- key: karpenter.azure.com/sku-cpu
206+
operator: Lt
207+
values: ["3"]
208+
- key: kubernetes.io/arch
209+
operator: In
210+
values: ["amd64"]
211+
- key: kubernetes.io/os
212+
operator: In
213+
values: ["linux"]
214+
- key: karpenter.sh/capacity-type
215+
operator: In
216+
values: ["on-demand"]
217+
nodeClassRef:
218+
group: karpenter.azure.com
219+
kind: AKSNodeClass
220+
name: default
221+
---
222+
apiVersion: karpenter.azure.com/v1alpha2
223+
kind: AKSNodeClass
224+
metadata:
225+
name: default
226+
annotations:
227+
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
228+
spec:
229+
imageFamily: Ubuntu2204
230+
EOF
231+
232+
kubectl apply -f ndb-nodepool.yaml
233+
```
234+
235+
```
236+
nodepool.karpenter.sh/default configured
237+
aksnodeclass.karpenter.azure.com/default unchanged
238+
```
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## Deploy NodePool:
2+
3+
Use the following command to deploy a `NodePool`, and `AKSNodeClass` for `Disruption Controls`, where we've made the nodes `expireAfter` 2 minutes, which will make the NodePool try to remove the nodes after 2 minutes.
4+
5+
> Note: setting `terminationGracePeriod` in addition to `expireAfter` is a good way to help define an absolute maximum lifetime of a node. The node would be deleted at `expireAfter` and finishes draining within the `terminationGracePeriod` thereafter. However, setting `terminationGracePeriod` will ignore `karpenter.sh/do-not-disrupt: "true"`, and take precedence over a pod's own `terminationGracePeriod` or blocking eviction like PDBs, so be careful using it.
6+
7+
```bash
8+
cd ~/environment/karpenter
9+
cat > eviction.yaml << EOF
10+
# This example NodePool will provision general purpose instances
11+
---
12+
apiVersion: karpenter.sh/v1
13+
kind: NodePool
14+
metadata:
15+
name: default
16+
annotations:
17+
kubernetes.io/description: "Basic NodePool for generic workloads"
18+
spec:
19+
disruption:
20+
consolidationPolicy: WhenEmpty
21+
consolidateAfter: 30s
22+
limits:
23+
cpu: "10"
24+
template:
25+
metadata:
26+
labels:
27+
# required for Karpenter to predict overhead from cilium DaemonSet
28+
kubernetes.azure.com/ebpf-dataplane: cilium
29+
eks-immersion-team: my-team
30+
spec:
31+
expireAfter: 2m0s
32+
startupTaints:
33+
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
34+
- key: node.cilium.io/agent-not-ready
35+
effect: NoExecute
36+
value: "true"
37+
requirements:
38+
- key: karpenter.azure.com/sku-family
39+
operator: In
40+
values: [D]
41+
- key: kubernetes.io/arch
42+
operator: In
43+
values: ["amd64"]
44+
- key: kubernetes.io/os
45+
operator: In
46+
values: ["linux"]
47+
- key: karpenter.sh/capacity-type
48+
operator: In
49+
values: ["on-demand"]
50+
nodeClassRef:
51+
group: karpenter.azure.com
52+
kind: AKSNodeClass
53+
name: default
54+
---
55+
apiVersion: karpenter.azure.com/v1alpha2
56+
kind: AKSNodeClass
57+
metadata:
58+
name: default
59+
annotations:
60+
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
61+
spec:
62+
imageFamily: Ubuntu2204
63+
EOF
64+
65+
kubectl apply -f eviction.yaml
66+
```
67+
68+
```
69+
nodepool.karpenter.sh/default created
70+
aksnodeclass.karpenter.azure.com/default created
71+
```

0 commit comments

Comments
 (0)