Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(workshop): add documentation for kubecon optional steps #568

Merged
merged 28 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/workshops/10_multi_node_consolidation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

## Deploy NodePool:

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`.
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`.

```bash
cd ~/environment/karpenter
Expand Down
238 changes: 238 additions & 0 deletions docs/workshops/12_scheduling_constraints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@

## Deploy NodePool:

### 2. Percentage-Base Disruption

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%`.

```bash
cd ~/environment/karpenter
cat > ndb-nodepool.yaml << EOF
# This example NodePool will provision general purpose instances
---
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
annotations:
kubernetes.io/description: "Basic NodePool for generic workloads"
spec:
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 30s
budgets:
- nodes: "40%"
limits:
cpu: "20"
template:
metadata:
labels:
# required for Karpenter to predict overhead from cilium DaemonSet
kubernetes.azure.com/ebpf-dataplane: cilium
eks-immersion-team: my-team
spec:
expireAfter: 720h # 30 days
startupTaints:
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
- key: node.cilium.io/agent-not-ready
effect: NoExecute
value: "true"
requirements:
- key: karpenter.azure.com/sku-family
operator: In
values: [D]
- key: karpenter.azure.com/sku-cpu
operator: Lt
values: ["3"]
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
- key: kubernetes.io/os
operator: In
values: ["linux"]
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
nodeClassRef:
group: karpenter.azure.com
kind: AKSNodeClass
name: default
---
apiVersion: karpenter.azure.com/v1alpha2
kind: AKSNodeClass
metadata:
name: default
annotations:
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
spec:
imageFamily: Ubuntu2204
EOF

kubectl apply -f ndb-nodepool.yaml
```

```
nodepool.karpenter.sh/default created
aksnodeclass.karpenter.azure.com/default created
```

### 3. Multiple Budget Policies

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.

> Note: modify the schedule to the current UTC time, to see it take effect while completing this workshop
```bash
cd ~/environment/karpenter
cat > ndb-nodepool.yaml << EOF
# This example NodePool will provision general purpose instances
---
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
annotations:
kubernetes.io/description: "Basic NodePool for generic workloads"
spec:
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 30s
budgets:
- nodes: "40%"
reasons:
- "Empty"
- "Drifted"
- nodes: "2"
- nodes: "0"
schedule: "0 21 * * *" # modify this line to the current UTC time
duration: 3h
limits:
cpu: "40"
template:
metadata:
labels:
# required for Karpenter to predict overhead from cilium DaemonSet
kubernetes.azure.com/ebpf-dataplane: cilium
eks-immersion-team: my-team
spec:
expireAfter: 720h # 30 days
startupTaints:
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
- key: node.cilium.io/agent-not-ready
effect: NoExecute
value: "true"
requirements:
- key: karpenter.azure.com/sku-family
operator: In
values: [D]
- key: karpenter.azure.com/sku-cpu
operator: Lt
values: ["3"]
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
- key: kubernetes.io/os
operator: In
values: ["linux"]
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
nodeClassRef:
group: karpenter.azure.com
kind: AKSNodeClass
name: default
---
apiVersion: karpenter.azure.com/v1alpha2
kind: AKSNodeClass
metadata:
name: default
annotations:
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
spec:
imageFamily: Ubuntu2204
EOF

kubectl apply -f ndb-nodepool.yaml
```

```
nodepool.karpenter.sh/default configured
aksnodeclass.karpenter.azure.com/default unchanged
```

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.

```bash
cd ~/environment/karpenter
cat > ndb-nodepool.yaml << EOF
# This example NodePool will provision general purpose instances
---
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
annotations:
kubernetes.io/description: "Basic NodePool for generic workloads"
spec:
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 30s
budgets:
- nodes: "40%"
reasons:
- "Empty"
- "Drifted"
- nodes: "2"
limits:
cpu: "10"
template:
metadata:
labels:
# required for Karpenter to predict overhead from cilium DaemonSet
kubernetes.azure.com/ebpf-dataplane: cilium
eks-immersion-team: my-team
spec:
expireAfter: 720h # 30 days
startupTaints:
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
- key: node.cilium.io/agent-not-ready
effect: NoExecute
value: "true"
requirements:
- key: karpenter.azure.com/sku-family
operator: In
values: [D]
- key: karpenter.azure.com/sku-cpu
operator: Lt
values: ["3"]
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
- key: kubernetes.io/os
operator: In
values: ["linux"]
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
nodeClassRef:
group: karpenter.azure.com
kind: AKSNodeClass
name: default
---
apiVersion: karpenter.azure.com/v1alpha2
kind: AKSNodeClass
metadata:
name: default
annotations:
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
spec:
imageFamily: Ubuntu2204
EOF

kubectl apply -f ndb-nodepool.yaml
```

```
nodepool.karpenter.sh/default configured
aksnodeclass.karpenter.azure.com/default unchanged
```
71 changes: 71 additions & 0 deletions docs/workshops/13_disruption_controls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## Deploy NodePool:

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.

> 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.

```bash
cd ~/environment/karpenter
cat > eviction.yaml << EOF
# This example NodePool will provision general purpose instances
---
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
annotations:
kubernetes.io/description: "Basic NodePool for generic workloads"
spec:
disruption:
consolidationPolicy: WhenEmpty
consolidateAfter: 30s
limits:
cpu: "10"
template:
metadata:
labels:
# required for Karpenter to predict overhead from cilium DaemonSet
kubernetes.azure.com/ebpf-dataplane: cilium
eks-immersion-team: my-team
spec:
expireAfter: 2m0s
startupTaints:
# https://karpenter.sh/docs/concepts/nodepools/#cilium-startup-taint
- key: node.cilium.io/agent-not-ready
effect: NoExecute
value: "true"
requirements:
- key: karpenter.azure.com/sku-family
operator: In
values: [D]
- key: kubernetes.io/arch
operator: In
values: ["amd64"]
- key: kubernetes.io/os
operator: In
values: ["linux"]
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
nodeClassRef:
group: karpenter.azure.com
kind: AKSNodeClass
name: default
---
apiVersion: karpenter.azure.com/v1alpha2
kind: AKSNodeClass
metadata:
name: default
annotations:
kubernetes.io/description: "Basic AKSNodeClass for running Ubuntu2204 nodes"
spec:
imageFamily: Ubuntu2204
EOF

kubectl apply -f eviction.yaml
```

```
nodepool.karpenter.sh/default created
aksnodeclass.karpenter.azure.com/default created
```
Loading