All Products
Search
Document Center

Container Service for Kubernetes:Jadwalkan pod ke node virtual Windows

Last Updated:May 12, 2026

ECI kini mendukung instans yang menjalankan sistem operasi Windows. Jika kontainer Anda memerlukan lingkungan Windows, Anda dapat menambahkan node virtual Windows ke kluster dan menjadwalkan pod ke node tersebut. Hal ini akan membuat pod ECI berbasis Windows (sebuah instans ECI) untuk menjalankan kontainer Anda.

Prasyarat

Batasan

  • Saat membuat instans ECI Windows, spesifikasi instans harus minimal 2 vCPU dan memori 4 GiB.

  • Versi gambar kontainer Windows harus 10.0.20348.*, yang sesuai dengan Windows Server 2022.

  • Fitur-fitur berikut tidak didukung:

    • Disk lokal tidak didukung.

    • GPU tidak didukung.

    • Kontainer Windows HostProcess tidak didukung.

    Untuk daftar fitur lain yang tidak didukung, lihat Windows containers in Kubernetes.

Tambahkan node virtual Windows

Ikuti langkah-langkah berikut untuk mengubah ConfigMap eci-profile dan menambahkan node virtual Windows ke kluster Anda.

Konsol

  1. Pada halaman ACK Clusters, klik nama kluster Anda. Di panel navigasi kiri, klik Configurations > ConfigMaps.

  2. Pilih namespace kube-system. Pada kolom Actions untuk ConfigMap eci-profile, klik Edit.

  3. Klik Add. Untuk Name, masukkan enableWindowsAmd64Node. Untuk Value, masukkan true. Lalu, klik OK.

  4. Di panel navigasi kiri, pilih Nodes > Node Pools untuk memverifikasi bahwa node virtual Windows telah ditambahkan.

Kubectl

  1. Dapatkan kubeconfig kluster dan gunakan kubectl untuk terhubung ke kluster.

  2. Edit ConfigMap eci-profile di kluster Anda.

    kubectl edit -n kube-system cm/eci-profile
  3. Pada bagian data, tambahkan konfigurasi enableWindowsAmd64Node: "true".

    data:
      ......
      enableWindowsAmd64Node: "true"   # Aktifkan node Windows
      ......
  4. Verifikasi bahwa node virtual Windows tersedia.

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

    Output yang diharapkan:

    NAME                                          STATUS   ROLES   AGE   VERSION
    virtual-kubelet-cn-hangzhou-i-windows-amd64   Ready    agent   23m   v1.34.3-aliyun.1
    virtual-kubelet-cn-hangzhou-j-windows-amd64   Ready    agent   23m   v1.34.3-aliyun.1
    virtual-kubelet-cn-hangzhou-k-windows-amd64   Ready    agent   23m   v1.34.3-aliyun.1

Contoh workload Windows

Node virtual Windows memiliki label kubernetes.io/os: windows. Saat membuat workload Windows, gunakan nodeSelector untuk menjadwalkan workload ke node virtual Windows.

Gunakan Rahasia

  1. Buat workload Windows dan pasang Secret ke direktori secrets pada drive C.

    Buat file bernama windows-deploy-secret-example.yaml dengan konten berikut. Kemudian, jalankan perintah kubectl apply -f windows-deploy-secret-example.yaml untuk membuat sumber daya.
    apiVersion: v1
    kind: Secret
    metadata:
      name: windows-test-secret
    type: Opaque
    stringData:
      username: testuser
      password: testpass123
      secret.txt: "This is a secret file for Windows Pod"
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: windows-deployment-secret-example
      labels:
        app: windows-secret-app
    spec:
      replicas: 1 # Jumlah replika diatur ke 1 untuk contoh ini.
      selector:
        matchLabels:
          app: windows-secret-app
      template:
        metadata:
          labels:
            app: windows-secret-app
            alibabacloud.com/acs: "true"
        spec:
          nodeSelector:
            kubernetes.io/os: windows
          containers:
          - name: test
            image: registry-cn-hangzhou.ack.aliyuncs.com/test/nanoserver:ltsc2022
            command: ["ping", "-t", "localhost"]
            resources:
              requests:
                cpu: "4"         
                memory: "8Gi"     
              limits:
                cpu: "4"         
                memory: "8Gi"
            volumeMounts:
            - name: secret-volume
              mountPath: C:\secrets
              readOnly: true
          volumes:
          - name: secret-volume
            secret:
              secretName: windows-test-secret
  2. Verifikasi bahwa workload berjalan sesuai harapan dan periksa isi Secret.

    1. Buka shell perintah di dalam kontainer.

      kubectl exec -it deployment/windows-deployment-secret-example -- cmd
    2. Di shell perintah, verifikasi isi Secret.

      # Buka direktori tempat Secret dipasang. 
      C:\>cd secrets
      
      # Tampilkan isi Secret.
      C:\secrets>type secret.txt
      This is a secret file for Windows Pod

Lampirkan EIP

  1. Instal komponen ack-extend-network-controller. Untuk informasi selengkapnya, lihat Lampirkan EIP ke Pod menggunakan anotasi.

  2. Buat workload Windows dengan anotasi network.alibabacloud.com/pod-with-eip: "true".

    Buat file bernama windows-deploy-eip-example.yaml dengan konten berikut. Kemudian, jalankan perintah kubectl apply -f windows-deploy-eip-example.yaml untuk membuat sumber daya.
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: windows-deployment-eip-example
      labels:
        app: windows-eip-app
    spec:
      replicas: 1 # Jumlah replika diatur ke 1 untuk contoh ini.
      selector:
        matchLabels:
          app: windows-eip-app
      template:
        metadata:
          labels:
            app: windows-eip-app
            alibabacloud.com/acs: "true"
          annotations:
            network.alibabacloud.com/pod-with-eip: "true"
        spec:
          nodeSelector:
            kubernetes.io/os: windows
          containers:
          - name: test
            image: registry-cn-hangzhou.ack.aliyuncs.com/test/nanoserver:ltsc2022
            command: ["ping", "-t", "localhost"]
            resources:
              requests:
                cpu: "4"
                memory: "8Gi"
              limits:
                cpu: "4"
                memory: "8Gi"
  3. Ambil EIP dari Pod.

    kubectl get pod $(kubectl get pods -l app=windows-eip-app -o jsonpath='{.items[0].metadata.name}') -o jsonpath="{.metadata.annotations['network\.alibabacloud\.com/allocated-eipAddress']}"
    Output Anda mungkin berbeda.