All Products
Search
Document Center

Container Service for Kubernetes:Create a Windows application

Last Updated:Mar 26, 2026

This example shows how to use an orchestration template to deploy an ASP.NET web application to a Windows node in an ACK cluster. The application consists of a Deployment and a Service of the LoadBalancer type, making it accessible from the Internet on port 80.

Prerequisites

Before you begin, ensure that you have:

Step 1: Deploy the sample application

Deploy a sample ASP.NET application to a Windows node. The Service automatically creates a Server Load Balancer instance and exposes port 80 of the application to the Internet.

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, find the cluster you want to manage and click its name. In the left navigation pane, choose Workloads > Deployments.

  3. Click Create From YAML and set Sample Template to Custom. Enter the YAML content shown below, then click Submit.

    The following YAML defines an ASP.NET web application. The tolerations and nodeAffinity fields ensure that the pod is scheduled only on Windows nodes in a mixed-OS cluster. The Service maps external port 80 to the container's port 8080 via targetPort.

    Replace <cn-hangzhou> in the image address with the region ID of your cluster, for example, cn-beijing.

    apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: web-windows
      name: web-windows
    spec:
      type: LoadBalancer
      ports:
        - port: 80
          protocol: TCP
          targetPort: 8080
      selector:
        app: web-windows
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: web-windows
      name: web-windows
    spec:
      selector:
        matchLabels:
          app: web-windows
      template:
        metadata:
          labels:
            app: web-windows
        spec:
          restartPolicy: Always
          terminationGracePeriodSeconds: 30
          tolerations:
          - key: os
            value: windows
          affinity:
            nodeAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                nodeSelectorTerms:
                - matchExpressions:
                  - key: kubernetes.io/os
                    operator: In
                    values:
                    - windows
          containers:
    # Replace <cn-hangzhou> in the image address with the actual region of your cluster.
            - image: registry-cn-hangzhou-vpc.ack.aliyuncs.com/acs/dotnet-samples:aspnetapp
              name: windows
              ports:
              - containerPort: 8080
                protocol: TCP

    After submission, you are returned to the Deployments page, where the new web application appears in the list.

  4. Verify that the pod is running:

    kubectl get pods -l app=web-windows

    The expected output is similar to:

    NAME                           READY   STATUS    RESTARTS   AGE
    web-windows-6d7f9d9b4c-xk2lp   1/1     Running   0          2m

Step 2: Access the application

  1. Get the external IP address assigned to the Service:

    kubectl get service web-windows

    The expected output is similar to:

    NAME          TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)        AGE
    web-windows   LoadBalancer   172.16.3.210   47.xxx.xxx.xxx   80:32001/TCP   3m

    The EXTERNAL-IP field may show <pending> for a minute or two while the Server Load Balancer instance is being provisioned. Run the command again until an IP address appears.

  2. On the Clusters page, find the cluster you want and click its name. In the left-side pane, choose Network > Services.

  3. Click the name of the target Service (web-windows). In the Basic Information section, click External IP to access the web application.

    image