Amazon EKS 优化版 Windows AMI - Amazon EKS

Amazon EKS 优化版 Windows AMI

Windows Amazon EKS 优化版 AMI 是基于 Windows Server 2019 和 Windows Server 2022 构建的。它们被配置作为 Amazon EKS 节点的基本映像。默认情况下,AMI 包括以下组件:

注意

您可以使用 Microsoft 安全更新指南跟踪 Windows Server 的安全或隐私事件。

Amazon EKS 提供了已针对 Windows 容器进行了优化的 AMI,包括以下变体:

  • Amazon EKS 优化版 Windows Server 2019 Core AMI

  • Amazon EKS 优化版 Windows Server 2019 Full AMI

  • Amazon EKS 优化版 Windows Server 2022 Core AMI

  • Amazon EKS 优化版 Windows Server 2022 Full AMI

重要
  • Amazon EKS 优化版 Windows Server 20H2 Core AMI 已弃用。不会发布此 AMI 的任何新版本。

  • 为了确保您在默认情况下安装了最新的安全更新,Amazon EKS 保留至少四个最新的 Windows Amazon EKS 优化版 AMI。在发布新的 Windows Amazon EKS 优化的 AMI 后,Amazon EKS 会将旧版的 Windows Amazon EKS 优化版 AMI 变为专有。如果存在需要访问的私有 AMI,请通过向 AWS Support 提交服务单来告知我们。

发布日历

下表列出了 Amazon EKS 上的 Windows 版本的发布日期和支持终止日期。如果终止日期为空,则是因为相应版本仍受支持。

Windows 版本 Amazon EKS 版本 Amazon EKS 支持终止
Windows Server 2022 Core 10/17/2022
Windows Server 2022 Full 10/17/2022
Windows Server 20H2 Core 8/12/2021 8/9/2022
Windows Server 2004 Core 8/19/2020 12/14/2021
Windows Server 2019 Core 10/7/2019
Windows Server 2019 Full 10/7/2019
Windows Server 1909 Core 10/7/2019 12/8/2020

引导脚本配置参数

创建 Windows 节点时,节点上有一个允许配置不同参数的脚本。根据您的设置,可以在节点上类似于以下位置:C:\Program Files\Amazon\EKS\Start-EKSBootstrap.ps1 找到此脚本。您可以通过将自定义参数值指定为引导脚本的参数。例如,您可以更新启动模板中的用户数据。有关更多信息,请参阅Amazon EC2 用户数据

此脚本包含以下参数:

  • -EKSClusterName:指定此 Worker 节点要加入的 Amazon EKS 集群名称。

  • -KubeletExtraArgs:为 kubelet 指定额外的参数(可选)。

  • -KubeProxyExtraArgs:为 kube-proxy 指定额外的参数(可选)。

  • -APIServerEndpoint:指定 Amazon EKS 集群 API 服务器端点(可选)。仅在与 -Base64ClusterCA 一起使用时才有效。绕过调用 Get-EKSCluster

  • -Base64ClusterCA:指定 base64 编码的集群 CA 内容(可选)。仅在与 -APIServerEndpoint 一起使用时才有效。绕过调用 Get-EKSCluster

  • -DNSClusterIP:覆盖用于集群内 DNS 查询的 IP 地址(可选)。基于主接口的 IP 地址,默认值为 10.100.0.10172.20.0.10

  • -ContainerRuntime – 指定要在节点上使用的容器运行时。

  • -ServiceCIDR – 覆盖从中寻址集群服务的 Kubernetes 服务 IP 地址范围。基于主接口的 IP 地址,默认值为 172.20.0.0/1610.100.0.0/16

  • -ExcludedSnatCIDRs – 要从源网络地址转换(SNAT)中排除的 IPv4 CIDR 列表。这意味着,VPC 可寻址的容器组(pod)私有 IP 不会转换为用于出站流量的实例 ENI 主 IPv4 地址的 IP 地址。默认情况下,系统会添加 Amazon EKS Windows 节点的 VPC 的 IPv4 CIDR。为该参数指定 CIDR 还会另外排除所指定的 CIDR。有关更多信息,请参阅适用于 Pods 的 SNAT

启用 containerd 运行时间引导标记

对于 Kubernetes 版本 1.23,您可以使用可选的引导标志,为 Amazon EKS 优化版 Windows AMI 启用 containerd 运行时系统。在更新到版本 1.24 或更高版本时,该功能提供迁移到 containerd 的清晰路径。Amazon EKS 将从 Kubernetes 版本 1.24 发布起,结束对 Docker 的支持。有关更多信息,请参阅Amazon EKS 结束了对 Dockershim 的支持

对于 Amazon EKS 版本 1.23,容器运行时系统支持的值为 dockercontainerd。容器运行时在使用 eksctl 或AWS Management Console启动 Windows 节点时指定。

  • 如果指定的值为 docker 且 Amazon EKS 版本为 1.23,则将 Docker 用作节点上的运行时系统。

  • 如果指定了任何其他值,则引导程序将失败,节点无法加入集群。

  • 如果未指定此标记,则选择容器运行时的默认值。对于 Amazon EKS 版本 1.23 和更早版本,默认值为 Docker。对于 1.24 和更高版本的集群,默认值为 containerd

在启动 Amazon EKS 集群中的 Windows 节点时,请按照 启动自行管理的 Windows 节点 中的步骤操作,使用 containerd 运行时的 Windows 自行管理的节点可以使用 eksctl 或 AWS Management Console 启动。

eksctl

要使用 eksctl 启用 containerd 运行时

对于 Windows 自行管理的节点,可以在创建新节点组时在配置中指定容器运行时。您可以使用以下 test-windows-with-containerd.yaml 作为参考。

注意

您必须使用 eksctl 版本 0.95.0 或更高版本以在配置文件中使用 containerRuntime 设置。

apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: windows-containerd-cluster region: us-west-2 version: 'X.XX' nodeGroups: - name: windows-ng instanceType: m5.2xlarge amiFamily: WindowsServer2019FullContainer volumeSize: 100 minSize: 2 maxSize: 3 containerRuntime: containerd - name: linux-ng amiFamily: AmazonLinux2 minSize: 2 maxSize: 3

然后,可以使用以下命令创建节点组。

eksctl create cluster -f test-windows-with-containerd.yaml
注意

eksctl 版本 0.95 开始,您无法再使用 preBootstrapCommands 为 Windows 节点配置 ContainerRuntime

有关更多信息,请参阅 eksctl 文档中的从配置文件创建节点组定义 containerd 运行时配置文件架构

AWS Management Console

要使用 AWS Management Console 启用 containerd 运行时

在 AWS CloudFormation 模板中,有一个名为 BootstrapArguments 的参数,它可用于将额外的参数传递给引导脚本。名为 ContainerRuntime 的参数可用于在节点上选择特定的运行时间。

BootstrapArguments 中指定以下内容以启用 containerd 运行时。

-ContainerRuntime containerd

通过 eksctl 启动自行管理的 Windows Server 2022 节点

Amazon EKS 优化版 Windows Server 2022 AMI 可用于 Kubernetes 版本 1.23 及更高版本。您可以使用以下 test-windows-2022.yaml 作为参考,将 Windows Server 2022 作为自行管理的节点运行。

注意

您必须使用 eksctl 版本 0.116.0 或更高版本来运行自行管理的 Windows Server 2022 节点。

apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: windows-2022-cluster region: us-west-2 version: '1.23' nodeGroups: - name: windows-ng instanceType: m5.2xlarge amiFamily: WindowsServer2022FullContainer volumeSize: 100 minSize: 2 maxSize: 3 - name: linux-ng amiFamily: AmazonLinux2 minSize: 2 maxSize: 3

然后,可以使用以下命令创建节点组。

eksctl create cluster -f test-windows-2022.yaml

gMSA 身份验证支持

Amazon EKS Windows Pods 允许不同类型的群组托管服务账户(gMSA)身份验证。

缓存的容器映像

Amazon EKS Windows 优化版 AMI 缓存了某些容器映像,用于 dockercontainerd 运行时系统。使用 Amazon 托管的构建组件构建自定义 AMI 时,系统会缓存容器映像。有关更多信息,请参阅使用 Amazon 托管的构建组件

对于 Amazon EKS 1.23 及更低版本

docker 运行时系统是默认选项,在 Amazon EKS Windows AMI 上缓存了以下容器映像。通过在 Amazon EKS Windows 节点上运行 docker 映像来检索此映像列表:

  • amazonaws.com/eks/pause-windows

  • mcr.microsoft.com/windows/nanoserver

  • mcr.microsoft.com/windows/servercore

containerd 运行时系统只有一个容器映像。通过运行 ctr -n k8s.io images list 检索此图像列表:

  • amazonaws.com/eks/pause-windows

对于 Amazon EKS 1.24 及更高版本

没有 docker 运行时系统。以下缓存的容器映像适用于 containerd 运行时系统:

  • amazonaws.com/eks/pause-windows

  • mcr.microsoft.com/windows/nanoserver

  • mcr.microsoft.com/windows/servercore

更多信息

有关使用 Amazon EKS 优化版 Windows AMI 的更多信息,请参阅以下部分: