|
| 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 | +``` |
0 commit comments