gpt4 book ai didi

kubernetes - 如何使用 Terraform 配置 AWS EKS 自动缩放器?

转载 作者:行者123 更新时间:2023-12-02 11:29:21 27 4
gpt4 key购买 nike

我正在使用 AWS EKS 提供商 (github.com/terraform-aws-modules/terraform-aws-eks)。我正在跟随 https://learn.hashicorp.com/terraform/aws/eks-intro 的教程

然而,这似乎没有启用自动缩放......似乎它缺少 cluster-autoscaler pods /守护进程?

Terraform 能否提供此功能?或者我是否需要按照以下指南进行设置:https://eksworkshop.com/scaling/deploy_ca/

最佳答案

您可以使用 Terraform 部署 Kubernetes 资源。有一个 Kubernetes 提供者和一个 Helm 提供者。

data "aws_eks_cluster_auth" "authentication" {
name = "${var.cluster_id}"
}

provider "kubernetes" {
# Use the token generated by AWS iam authenticator to connect as the provider does not support exec auth
# see: https://github.com/terraform-providers/terraform-provider-kubernetes/issues/161
host = "${var.cluster_endpoint}"

cluster_ca_certificate = "${base64decode(var.cluster_certificate_authority_data)}"
token = "${data.aws_eks_cluster_auth.authentication.token}"
load_config_file = false
}

provider "helm" {
install_tiller = "true"
tiller_image = "gcr.io/kubernetes-helm/tiller:v2.12.3"
}

resource "helm_release" "cluster_autoscaler" {
name = "cluster-autoscaler"
repository = "stable"
chart = "cluster-autoscaler"
namespace = "kube-system"
version = "0.12.2"

set {
name = "autoDiscovery.enabled"
value = "true"
}

set {
name = "autoDiscovery.clusterName"
value = "${var.cluster_name}"
}

set {
name = "cloudProvider"
value = "aws"
}

set {
name = "awsRegion"
value = "${data.aws_region.current_region.name}"
}

set {
name = "rbac.create"
value = "true"
}

set {
name = "sslCertPath"
value = "/etc/ssl/certs/ca-bundle.crt"
}
}

关于kubernetes - 如何使用 Terraform 配置 AWS EKS 自动缩放器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57928941/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com