[英]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.