
twinproduction/aws-eks-asg-rolling-update-handleraws-eks-asg-rolling-update-handler是一款用于AWS EKS集群中自动扩展组(ASG)滚动更新的工具。它通过识别并替换配置过时的节点(即节点当前配置与ASG的启动模板版本或启动配置不匹配的节点),实现ASG的滚动升级。该工具受aws-asg-roller启发,专注于优雅缩容过时节点,不控制节点总数,而是依赖cluster-autoscaler进行后续节点数量调整。与其他解决方案相比,它基于资源需求确定扩容节点数量,尤其适用于实例类型变更等场景,确保更新过程中的高可用性。
| 环境变量 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|
| CLUSTER_NAME | EKS集群名称,用于替代AUTO_SCALING_GROUP_NAMES。会检查ASG上是否有k8s.io/cluster-autoscaler/<CLUSTER_NAME>: owned和k8s.io/cluster-autoscaler/enabled: true标签 | 是 | "" |
| AUTO_SCALING_GROUP_NAMES | 逗号分隔的ASG名称列表,CLUSTER_NAME优先级更高 | 是 | "" |
| IGNORE_DAEMON_SETS | 排空节点时是否忽略DaemonSets | 否 | true |
| DELETE_LOCAL_DATA | 排空节点时是否删除本地数据 | 否 | true |
| AWS_REGION | AWS区域 | 否 | us-west-2 |
| ENVIRONMENT | 若设为dev,使用本地kubeconfig创建Kubernetes客户端;其他值使用集群内配置 | 否 | "" |
应用需具备以下AWS权限以正常工作:
yamlapiVersion: core/v1 kind: ServiceAccount metadata: name: aws-eks-asg-rolling-update-handler namespace: kube-system labels: k8s-app: aws-eks-asg-rolling-update-handler --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: name: aws-eks-asg-rolling-update-handler labels: k8s-app: aws-eks-asg-rolling-update-handler rules: - apiGroups: - "*" resources: - "*" verbs: - get - list - watch - apiGroups: - "*" resources: - nodes verbs: - get - list - watch - update - patch - apiGroups: - "*" resources: - pods/eviction verbs: - get - list - create - apiGroups: - "*" resources: - pods verbs: - get - list --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: aws-eks-asg-rolling-update-handler labels: k8s-app: aws-eks-asg-rolling-update-handler roleRef: kind: ClusterRole name: aws-eks-asg-rolling-update-handler apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount name: aws-eks-asg-rolling-update-handler namespace: kube-system --- apiVersion: apps/v1 kind: Deployment metadata: name: aws-eks-asg-rolling-update-handler namespace: kube-system labels: k8s-app: aws-eks-asg-rolling-update-handler spec: replicas: 1 template: metadata: labels: k8s-app: aws-eks-asg-rolling-update-handler spec: automountServiceAccountToken: true serviceAccountName: aws-eks-asg-rolling-update-handler restartPolicy: Always dnsPolicy: Default containers: - name: aws-eks-asg-rolling-update-handler image: twinproduction/aws-eks-asg-rolling-update-handler imagePullPolicy: Always env: - name: AUTO_SCALING_GROUP_NAMES value: "asg-1,asg-2,asg-3" # 替换为实际的ASG名称列表
通过Helm chart部署:
shhelm repo add twinproduction [***] helm repo update helm install aws-eks-asg-rolling-update-handler twinproduction/aws-eks-asg-rolling-update-handler
本地运行时需:
ENVIRONMENT=dev和AUTO_SCALING_GROUP_NAMES(逗号分隔的ASG名称列表)。



manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务