creamy-stone-99746
04/18/2024, 5:37 PMcreamy-stone-99746
04/18/2024, 5:39 PMmodule "eks" {
source = "terraform-aws-modules/eks/aws"
version = "17.23.0"
cluster_name = local.cluster_name
cluster_version = "1.24"
subnets = module.vpc.private_subnets
enable_irsa = true
tags = local.tags
vpc_id = module.vpc.vpc_id
node_groups_defaults = {
ami_type = "AL2_x86_64"
disk_size = 50
}
node_groups = {
main = {
desired_capacity = 1
max_capacity = 500
min_capacity = 1
instance_types = ["r5.large", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge"]
update_config = {
max_unavailable_percentage = 50
}
}
}
workers_additional_policies = [
aws_iam_policy.default_node.arn,
aws_iam_policy.cluster_autoscaler.arn,
]
}creamy-stone-99746
04/18/2024, 5:40 PM@kubernetes(cpu=8, memory="14000")
I get
0/1 nodes are available: 1 Insufficient cpu. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.hundreds-zebra-57629
04/18/2024, 5:48 PMinstance_types field in the node group, it always selects the first instance type and only goes to the next if the first type is unavailable due to a quota limit or something. I am not sure if it actually decided to go down the order if the first instance type is too small to fit the requested resource. I'd create a node group per instance type and set the min and desired capacity to 0 for all but the r5.large one.creamy-stone-99746
04/18/2024, 5:55 PMhundreds-zebra-57629
04/18/2024, 6:03 PMcreamy-stone-99746
04/18/2024, 6:21 PMnode_groups = {
main = {
desired_capacity = 1
max_capacity = 5
min_capacity = 1
instance_types = ["r5.large"]
update_config = {
max_unavailable_percentage = 50
}
}
larger = {
desired_capacity = 1
max_capacity = 5
min_capacity = 1
instance_types = ["r5.xlarge"]
update_config = {
max_unavailable_percentage = 50
}
}
Then had @kubernetes(cpu=4, memory="6000") which a r5.xlarge should have no trouble with. But I get
0/2 nodes are available: 2 Insufficient cpu. preemption: 0/2 nodes are available: 2 No preemption victims found for incoming pod.creamy-stone-99746
04/18/2024, 6:39 PMNotTriggerScaleUp a few seconds ago cluster-autoscaler pod didn't trigger scale-up: 1 Insufficient ephemeral-storage, 2 Insufficient cpuhundreds-zebra-57629
04/18/2024, 6:42 PMcreamy-stone-99746
04/18/2024, 8:00 PMhundreds-zebra-57629
04/18/2024, 8:43 PMrequests section of the pod that is in a pending state? Just want to confirm it is asking for 3vCPU and 6Gi memorycreamy-stone-99746
04/18/2024, 8:58 PMhundreds-zebra-57629
04/18/2024, 9:03 PMkubectl -n <your-namespace> get pod <pending-opod-name> -oyaml . Then you can look for the resources block in the yaml. Here is an example block:
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"creamy-stone-99746
04/18/2024, 9:06 PMresources:
requests:
cpu: "3"
ephemeral-storage: 10240M
memory: 6Ghundreds-zebra-57629
04/18/2024, 9:15 PMdisk_size on your node groups. Are you setting them as part of a launch template somewhere? Can you check what the current size of the disk is?creamy-stone-99746
04/18/2024, 9:16 PMlaunch templatecreamy-stone-99746
04/18/2024, 9:19 PM<http://eks.tf|eks.tf>
node_groups_defaults = {
ami_type = "AL2_x86_64"
disk_size = 50
}hundreds-zebra-57629
04/18/2024, 9:19 PMr5.large node in k8s. The ephermal storage size should be under the Allocatable key. Since you are setting up the other node group the same way, I'd expect it to have the same disk size.creamy-stone-99746
04/18/2024, 9:21 PMmodule "eks" {
source = "terraform-aws-modules/eks/aws"
version = "17.23.0"
cluster_name = local.cluster_name
cluster_version = "1.24"
subnets = module.vpc.private_subnets
enable_irsa = true
tags = local.tags
vpc_id = module.vpc.vpc_id
node_groups_defaults = {
ami_type = "AL2_x86_64"
disk_size = 50
}
# "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge"
node_groups = {
main = {
desired_capacity = 1
max_capacity = 5
min_capacity = 1
instance_types = ["r5.large"]
update_config = {
max_unavailable_percentage = 50
}
}
larger = {
desired_capacity = 0
max_capacity = 5
min_capacity = 0
instance_types = ["r5.xlarge"]
update_config = {
max_unavailable_percentage = 50
}
}
largerest = {
desired_capacity = 0
max_capacity = 5
min_capacity = 0
instance_types = ["r5.2xlarge"]
update_config = {
max_unavailable_percentage = 50
}
}
superlargest = {
desired_capacity = 0
max_capacity = 5
min_capacity = 0
instance_types = ["r5.8xlarge"]
update_config = {
max_unavailable_percentage = 50
}
}
}
workers_additional_policies = [
aws_iam_policy.default_node.arn,
aws_iam_policy.cluster_autoscaler.arn,
]
}
resource "aws_iam_policy" "default_node" {
name_prefix = "${local.cluster_name}-default"
description = "Default policy for cluster ${module.eks.cluster_id}"
policy = data.aws_iam_policy_document.default_node.json
}
data "aws_iam_policy_document" "default_node" {
statement {
sid = "S3"
effect = "Allow"
actions = [
"s3:*",
"kms:*",
]
resources = ["*"]
}
}
resource "aws_iam_policy" "cluster_autoscaler" {
name_prefix = "cluster-autoscaler"
description = "EKS cluster-autoscaler policy for cluster ${module.eks.cluster_id}"
policy = data.aws_iam_policy_document.cluster_autoscaler.json
}
data "aws_iam_policy_document" "cluster_autoscaler" {
statement {
sid = "clusterAutoscalerAll"
effect = "Allow"
actions = [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeTags",
"ec2:DescribeLaunchTemplateVersions",
]
resources = ["*"]
}
statement {
sid = "clusterAutoscalerOwn"
effect = "Allow"
actions = [
"autoscaling:SetDesiredCapacity",
"autoscaling:TerminateInstanceInAutoScalingGroup",
"autoscaling:UpdateAutoScalingGroup",
]
resources = ["*"]
condition {
test = "StringEquals"
variable = "autoscaling:ResourceTag/kubernetes.io/cluster/${module.eks.cluster_id}"
values = ["owned"]
}
condition {
test = "StringEquals"
variable = "autoscaling:ResourceTag/k8s.io/cluster-autoscaler/enabled"
values = ["true"]
}
}
}
data "aws_eks_cluster" "cluster" {
name = module.eks.cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = module.eks.cluster_id
}
data "aws_caller_identity" "current" {}
provider "kubernetes" {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
}creamy-stone-99746
04/19/2024, 5:52 PMhundreds-zebra-57629
04/19/2024, 5:54 PMNotTriggerScaleUp a few seconds ago cluster-autoscaler pod didn't trigger scale-up: 1 Insufficient ephemeral-storage, 2 Insufficient cpu
My thought is that there is not enough disk space on the node.hundreds-zebra-57629
04/19/2024, 5:54 PMcreamy-stone-99746
04/19/2024, 5:54 PMhundreds-zebra-57629
04/19/2024, 5:55 PMhundreds-zebra-57629
04/19/2024, 5:55 PMcreamy-stone-99746
04/19/2024, 5:55 PMhundreds-zebra-57629
04/19/2024, 5:58 PMkubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{.status.allocatable}{"\n"}{end}'creamy-stone-99746
04/19/2024, 6:03 PMhundreds-zebra-57629
04/19/2024, 6:05 PMr5.xlarge is configured using a different value for disk, it looks like ephermal-storage shouldn't be an issue.creamy-stone-99746
04/19/2024, 6:05 PMI0419 18:05:21.474205 1 orchestrator.go:542] Pod default/t-1336a11f-nf54f-d5n8l can't be scheduled on eks-mf-i7fc4m46-main20240419175615353800000003-b2c77bc0-3be9-62ab-a7d0-9db3ffed4b9c, predicate checking error: Insufficient cpu; predicateName=NodeResourcesFit; reasons: Insufficient cpu; debugInfo=
I0419 18:05:21.474257 1 orchestrator.go:542] Pod default/t-1336a11f-nf54f-d5n8l can't be scheduled on eks-mf-i7fc4m46-memory_instances20240419175615353800000001-12c77bc0-3be7-931b-4659-5f3ec089140f, predicate checking error: Insufficient ephemeral-storage; predicateName=NodeResourcesFit; reasons: Insufficient ephemeral-storage; debugInfo=
I0419 18:05:21.474274 1 orchestrator.go:150] No pod can fit to eks-mf-i7fc4m46-main20240419175615353800000003-b2c77bc0-3be9-62ab-a7d0-9db3ffed4b9c
I0419 18:05:21.474292 1 orchestrator.go:150] No pod can fit to eks-mf-i7fc4m46-memory_instances20240419175615353800000001-12c77bc0-3be7-931b-4659-5f3ec089140f
I0419 18:05:21.474308 1 orchestrator.go:164] No expansion optionscreamy-stone-99746
04/19/2024, 6:07 PMhundreds-zebra-57629
04/19/2024, 6:07 PMlarge node group as well. Do you see any?creamy-stone-99746
04/19/2024, 6:07 PMcreamy-stone-99746
04/19/2024, 6:08 PMhundreds-zebra-57629
04/22/2024, 9:54 PMresource "aws_autoscaling_group_tag" "cluster_autoscaler_resource_tags" {
for_each = module.eks.eks_managed_node_groups
autoscaling_group_name = each.value.node_group_autoscaling_group_names[0]
tag {
key = "<http://k8s.io/cluster-autoscaler/node-template/resources/ephemeral-storage|k8s.io/cluster-autoscaler/node-template/resources/ephemeral-storage>"
value = "100G"
propagate_at_launch = true
}
}millions-horse-99435
08/30/2024, 9:49 AMeks_managed_node_groups so this snippet above won't work with it. Is there an updated EKS configuration for a more recent module version somewhere that this snippet works with?millions-horse-99435
08/30/2024, 10:11 AMresource "aws_autoscaling_group_tag" "cluster_autoscaler_resource_tags" {
for_each = module.eks.node_groups
autoscaling_group_name = each.value.resources[0].autoscaling_groups[0].name
tag {
key = "<http://k8s.io/cluster-autoscaler/node-template/resources/ephemeral-storage|k8s.io/cluster-autoscaler/node-template/resources/ephemeral-storage>"
value = "50G"
propagate_at_launch = true
}
}
and it seems to have worked. Thanks!melodic-ice-23640
12/11/2024, 3:17 PMhundreds-zebra-57629
12/12/2024, 5:40 PMmelodic-ice-23640
12/15/2024, 5:17 AM