All Products
Search
Document Center

Container Service for Kubernetes:Jadwalkan pod ke node virtual Windows

Last Updated:Sep 15, 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

  • Pembuatan workload Windows merupakan fitur beta yang hanya tersedia berdasarkan undangan. Untuk mencoba fitur ini, submit a ticket.

  • Add-on ACK Virtual Node di kluster Anda harus versi v2.11.0-rc.0 atau lebih baru. Untuk informasi selengkapnya, lihat Manage components dan ACK Virtual Node.

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.

    • Komputasi GPU tidak didukung.

    • Kontainer Windows HostProcess tidak didukung.

    Untuk daftar lengkap fitur 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 sudah ada.

    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

Karena node virtual Windows memiliki label kubernetes.io/os: windows, Anda harus menggunakan nodeSelector untuk menentukan node virtual Windows saat membuat workload Windows.

Gunakan Secret dalam workload Windows

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

    Buat file bernama windows-deploy-secret-example.yaml dengan konten berikut, lalu 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 # Untuk contoh ini, jumlah replika diatur menjadi 1
      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 di dalam kontainer.

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

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

Lampirkan EIP ke workload Windows

  1. Instal add-on ack-extend-network-controller. Untuk informasi selengkapnya, lihat Attach an EIP to a Pod by using an annotation.

  2. Gunakan anotasi network.alibabacloud.com/pod-with-eip: "true" untuk membuat workload Windows.

    Buat file windows-deploy-eip-example.yaml dengan konten berikut, lalu jalankan 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 # Untuk contoh ini, jumlah replika diatur menjadi 1
      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']}"
    EIP yang dikembalikan akan berbeda-beda.