You can build a Docker image of the Windows application you want to deploy, allowing the cluster to pull it from the repository during workload deployment. After creating the image, you can create a Windows node pool in the Container Service for Kubernetes (ACK) cluster to deploy the image onto Windows nodes.
Step 1: Build an image and push it to an image repository
To deploy your application, first convert it into a custom Windows image. You can build a custom image using the Windows Server Core base image. For applications with minimal dependencies on system libraries, consider using the Nano Server or the official PowerShell image.
The following example uses Windows Server Core as the base image to build a custom Docker image. The base image includes an executable file test.exe and a PowerShell script hello.ps1. PowerShell scripts (.ps1 files) are commonly used during Windows application deployment for preprocessing and initialization tasks, such as configuring environment variables and copying files.
In the following Dockerfile example, FROM mcr.microsoft.com/windows/servercore:ltsc2019 specifies the version ltsc2019, which can only run on Windows Server 2019. If your node requires Windows Server 2022, replace 2019 with 2022: mcr.microsoft.com/windows/servercore:ltsc2022.
# Use Windows Server Core as the base image
FROM mcr.microsoft.com/windows/servercore:ltsc2019
# Set the working directory
WORKDIR /app
# Copy local files into the container
COPY test.exe .
COPY hello.ps1 .
# Run the PowerShell script
CMD ["powershell.exe", "./hello.ps1"]
After creating the custom Dockerfile, build the image by running the docker build command. Once the image is built, push it to the image repository of Alibaba Cloud Container Registry by following the steps in this topic: Use Container Registry Enterprise Edition instances to build images. Future deployments can save time by pulling the image directly from the Container Registry.
Step 2: Create a node pool
To set up a Windows node pool and manage Windows nodes at the pool level, including node upgrades and scaling, follow the steps in Create a Windows node pool.
Step 3: Deploy the application
After creating the Windows node pool, use the Docker image created in the preceding step to deploy workloads. For more information, see Create a Windows application.