EKS节点EC2推荐采用Managed Node托管节点组,其使用的操作系统AMI清单参考这里:
https://docs.aws.amazon.com/zh_cn/eks/latest/userguide/eks-linux-ami-versions.html
由于操作系统需要定期升级更新,因此对EKS节点升级可通过刷新Node Group对应的AMI来进行版本升级。
执行如下命令查询当前节点组的名字:
eksctl get nodegroup --cluster eksworkshop
返回结果如下:
CLUSTER NODEGROUP STATUS CREATED MIN SIZE MAX SIZE DESIRED CAPACITY INSTANCE TYPE IMAGE ID ASG NAME TYPE
eksworkshop managed-ng ACTIVE 2022-08-10T02:36:42Z 3 6 3 t3.2xlarge AL2_x86_64 eks-managed-ng-88c142ce-3860-677c-45b7-62e1b52d9e95 managed
以上信息中,节点组名为“managed-ng”。接下来升级他的系统镜像版本,执行如下命令:
eksctl upgrade nodegroup --name=managed-ng --cluster=eksworkshop
过一段时间即可看到升级成功。
升级成功会显示如下信息:
2022-08-11 15:44:18 [ℹ] setting ForceUpdateEnabled value to false
2022-08-11 15:44:18 [ℹ] updating nodegroup stack
2022-08-11 15:44:19 [ℹ] waiting for CloudFormation changeset "eksctl-update-nodegroup-1660203858" for stack "eksctl-eksworkshop-nodegroup-managed-ng"
2022-08-11 15:44:51 [ℹ] waiting for CloudFormation changeset "eksctl-update-nodegroup-1660203858" for stack "eksctl-eksworkshop-nodegroup-managed-ng"
2022-08-11 15:44:52 [ℹ] waiting for CloudFormation stack "eksctl-eksworkshop-nodegroup-managed-ng"
2022-08-11 15:45:24 [ℹ] waiting for CloudFormation stack "eksctl-eksworkshop-nodegroup-managed-ng"
2022-08-11 15:45:26 [ℹ] nodegroup "managed-ng" is already up-to-date
2022-08-11 15:45:26 [ℹ] upgrading nodegroup version
2022-08-11 15:45:26 [ℹ] updating nodegroup stack
2022-08-11 15:45:27 [ℹ] waiting for CloudFormation changeset "eksctl-update-nodegroup-1660203926" for stack "eksctl-eksworkshop-nodegroup-managed-ng"
2022-08-11 15:45:27 [ℹ] nothing to update
2022-08-11 15:45:27 [ℹ] nodegroup successfully upgraded
升级完成。