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
Submit a ticket untuk meminta akses ke fitur ini.
Komponen ACK Virtual Node di kluster Anda harus menggunakan versi v2.11.0-rc.0 atau lebih baru. Untuk informasi selengkapnya, lihat Kelola komponen 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.
-
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
Pada halaman ACK Clusters, klik nama kluster Anda. Di panel navigasi kiri, klik .
Pilih namespace
kube-system. Pada kolom Actions untuk ConfigMapeci-profile, klik Edit.Klik Add. Untuk Name, masukkan
enableWindowsAmd64Node. Untuk Value, masukkantrue. Lalu, klik OK.Di panel navigasi kiri, pilih untuk memverifikasi bahwa node virtual Windows telah ditambahkan.
Kubectl
Dapatkan kubeconfig kluster dan gunakan kubectl untuk terhubung ke kluster.
Edit ConfigMap
eci-profiledi kluster Anda.kubectl edit -n kube-system cm/eci-profilePada bagian
data, tambahkan konfigurasienableWindowsAmd64Node: "true".data: ...... enableWindowsAmd64Node: "true" # Aktifkan node Windows ......Verifikasi bahwa node virtual Windows tersedia.
kubectl get nodes -l kubernetes.io/os=windowsOutput 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
-
Buat workload Windows dan pasang Secret ke direktori
secretspada drive C.Buat file bernama
windows-deploy-secret-example.yamldengan konten berikut. Kemudian, jalankan perintahkubectl apply -f windows-deploy-secret-example.yamluntuk 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 -
Verifikasi bahwa workload berjalan sesuai harapan dan periksa isi Secret.
-
Buka shell perintah di dalam kontainer.
kubectl exec -it deployment/windows-deployment-secret-example -- cmd -
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
-
Instal komponen ack-extend-network-controller. Untuk informasi selengkapnya, lihat Lampirkan EIP ke Pod menggunakan anotasi.
-
Buat workload Windows dengan anotasi
network.alibabacloud.com/pod-with-eip: "true".Buat file bernama
windows-deploy-eip-example.yamldengan konten berikut. Kemudian, jalankan perintahkubectl apply -f windows-deploy-eip-example.yamluntuk 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" -
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.