-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(k8s): update priority classes to play nice with karpenter & pre…
…emption (#801) <!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
- Loading branch information
1 parent
1976900
commit 7b17295
Showing
22 changed files
with
133 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Define low-priority deployments to maintain unallocated capacity on Karpenter | ||
# cluster to prevent premption. | ||
# | ||
# Higher replicas + lower resoruces = more smaller pods can preempt | ||
# Lower replicas + higher resources = larger pod can preempt, but will require bigger preempted "wedges" | ||
# | ||
# https://aws.amazon.com/blogs/containers/eliminate-kubernetes-node-scaling-lag-with-pod-priority-and-over-provisioning/ | ||
|
||
resource "kubernetes_namespace" "karpenter_overprovision" { | ||
metadata { | ||
name = "karpenter-overprovision" | ||
} | ||
} | ||
|
||
resource "kubernetes_priority_class" "overprovision_priority" { | ||
metadata { | ||
name = "overprovision-priority" | ||
} | ||
value = -1 | ||
} | ||
|
||
resource "kubernetes_deployment" "overprovision" { | ||
metadata { | ||
name = "overprovision" | ||
namespace = kubernetes_namespace.karpenter_overprovision.metadata.0.name | ||
labels = { | ||
app = "overprovisioning" | ||
} | ||
} | ||
|
||
spec { | ||
replicas = 2 | ||
|
||
selector { | ||
match_labels = { | ||
app = "overprovisioning" | ||
} | ||
} | ||
|
||
template { | ||
metadata { | ||
labels = { | ||
app = "overprovisioning" | ||
} | ||
} | ||
|
||
spec { | ||
container { | ||
name = "pause" | ||
image = "registry.k8s.io/pause" | ||
|
||
resources { | ||
requests = { | ||
cpu = "1" | ||
memory = "500Mi" | ||
} | ||
|
||
limits = { | ||
cpu = "1" | ||
memory = "500Mi" | ||
} | ||
} | ||
} | ||
|
||
priority_class_name = kubernetes_priority_class.overprovision_priority.metadata.0.name | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Used for services that can be preempted often. | ||
# | ||
# We set almost everything to this class (even crucial infrastrcuture) because | ||
# we need to wait for Karpenter to boot a new node instead of shutting down | ||
# existing services. | ||
resource "kubernetes_priority_class" "service_priority" { | ||
|
||
metadata { | ||
name = "service-priority" | ||
} | ||
value = 50 | ||
} | ||
|
||
# Used for anything required to monitor the other services. These should take | ||
# priority no matter what in order to ensure we have visibility on what's going | ||
# on. | ||
resource "kubernetes_priority_class" "monitoring_priority" { | ||
|
||
metadata { | ||
name = "monitoring-priority" | ||
} | ||
value = 50 | ||
} | ||
|
||
# Used for anything stateful that should not be frequently preempted. | ||
resource "kubernetes_priority_class" "stateful_priority" { | ||
|
||
metadata { | ||
name = "stateful-priority" | ||
} | ||
value = 60 | ||
} | ||
|
||
# Used for daemons that run on the machines and need to be scheduled no matter what. | ||
resource "kubernetes_priority_class" "daemon_priority" { | ||
|
||
metadata { | ||
name = "daemon-priority" | ||
} | ||
value = 90 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.