文档

(邀测)调度Pod到Windows虚拟节点

更新时间:

ECI已支持操作系统为Windows的实例。如果您的容器需要运行在Windows环境,您可以在集群中添加Windows虚拟节点,并将Pod调度到该虚拟节点上,即可创建出操作系统为Windows的ECI Pod(即ECI实例)来运行容器。

重要

Windows实例正在邀测中,如需使用,请提交工单申请。

前提条件

集群中的VK(ACK Virtual Node组件)版本为v2.11.0-rc.0及以上版本。更多信息,请参见管理组件ACK Virtual Node

使用限制

  • 创建操作系统为Windows的ECI实例时,vCPU和内存必须大于等于2 vCPU,4 GiB内存,并且不支持GPU、本地盘和ARM规格。

  • Windows容器镜像的版本号需要满足10.0.20348.*,即Windows Server 2022。

添加Windows虚拟节点

您可以通过以下步骤修改eci-profile,在集群中添加Windows虚拟节点。

  1. 修改eci-profile。

    kubectl edit -n kube-system cm/eci-profile

    在eci-profile的data中将enableWindowsAmd64Node配置为true,示例如下:

    data:
      ......
      enableWindowsAmd64Node: "true"   #启用Windows节点
      ......
  2. 查看集群中是否已有Windows虚拟节点。

    kubectl get nodes -l kubernetes.io/os=windows

    预期返回如下,可以看到集群已自动生成Windows虚拟节点。

    windows.png

创建操作系统为Windows的Pod

由于Windows虚拟节点带有"kubernetes.io/os": windows的标签,创建ECI Pod时,可以通过nodeSelector来指定Windows虚拟节点,将Pod调度到Windows虚拟节点上运行,即创建出操作系统为Windows的ECI Pod来运行容器。

nodeSelector:
  kubernetes.io/os: windows 

YAML示例如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-windows
  labels:
    app: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      name: nginx-test
      labels:
        app: nginx
        alibabacloud.com/eci: "true" 
      annotations:
        k8s.aliyun.com/eci-with-eip: "true"              # 绑定EIP以便拉取公网镜像
        k8s.aliyun.com/eci-use-specs: "ecs.c6.4xlarge"   # 指定规格
    spec:
      containers:
      - name: test
        image: mcr.microsoft.com/windows/nanoserver:ltsc2022   # 使用Windows容器镜像
        command: ["ping","-t","localhost" ]
      nodeSelector:
        kubernetes.io/os: windows  # 调度到Windows虚拟节点
  • 本页导读 (1)
文档反馈