[英]k8s deployment is not scaling on eks cluster too many pods
我還是個菜鳥,所以 go 請對我溫柔一點!
我有一個使用此節點組配置運行的 eks 集群:
resource "aws_eks_node_group" "this" {
cluster_name = aws_eks_cluster.this.name
node_group_name = local.cluster_name
node_role_arn = aws_iam_role.eks_node.arn
subnet_ids = aws_subnet.this.*.id
instance_types = ["t2.micro"]
scaling_config {
desired_size = 2
max_size = 4
min_size = 2
}
# Optional: Allow external changes without Terraform plan difference
lifecycle {
ignore_changes = [scaling_config[0].desired_size]
}
depends_on = [
aws_iam_role_policy_attachment.eks_AmazonEKSWorkerNodePolicy,
aws_iam_role_policy_attachment.eks_AmazonEKS_CNI_Policy,
aws_iam_role_policy_attachment.eks_AmazonEC2ContainerRegistryReadOnly,
]
}
我的縮放配置是:
scaling_config {
desired_size = 2
max_size = 4
min_size = 2
}
我可以使用以下配置成功部署2
nginx 副本:
resource "kubernetes_deployment" "nginx" {
metadata {
name = "nginx"
labels = {
App = "Nginx"
}
}
spec {
replicas = 2
selector {
match_labels = {
App = "Nginx"
}
}
template {
metadata {
labels = {
App = "Nginx"
}
}
spec {
container {
image = "nginx:1.7.8"
name = "nginx"
port {
container_port = 80
}
resources {
limits = {
cpu = "0.5"
memory = "512Mi"
}
requests = {
cpu = "250m"
memory = "50Mi"
}
}
}
}
}
}
}
但是當我將我的副本擴展到4
時,創建了 pod,但處於待處理的 state 中,原因如下:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 18s (x2 over 108s) default-scheduler 0/2 nodes are available: 2 Too many pods.
我嘗試忽略scaling_config
中的desired_size
但無助於解決問題。
我相信我缺少對使用 scaling_config 及其創建的縮放組和 k8s 部署副本的重要理解。 任何幫助我了解正在發生的事情的指導,將不勝感激。 非常感謝提前。
根據消息0/2 nodes are available: 2 Too many pods.
,可以發現該節點不能放置任何pod。 在 EKS 中,最大 pod 的數量可以放置在節點中,這取決於instance type
和cni
的幾個方面。 默認可以參考這個文檔eni-max-pod
要解決您的問題,您可以將desired_size
從 2 增加到 3。這樣 Pod 就會被放置到新節點上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.