All Products
Search
Document Center

Container Service for Kubernetes:Quickly deploy a Knative application

Last Updated:Mar 26, 2026

Deploy workloads as Knative Services to run applications that scale automatically with traffic, including scaling down to zero pods when idle. Knative Services are suited for web application hosting, serverless application deployment, AI tasks, and event-driven applications.

Prerequisites

Before you begin, make sure that you have:

Step 1: Deploy a Knative Service

Deploy a Knative Service using the ACK console or a YAML manifest.

Use the console

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

  2. On the Clusters page, click the name of your cluster. In the left navigation pane, choose Applications > Knative.

  3. On the Services tab, select the target namespace from the top navigation bar, and then click Create Service.

  4. Configure the following parameters and click Create.

    Parameter Description
    Service Name A name for the Knative Service.
    Image Name Click Select Image to choose a container image from your registry. You can also enter a private image in the format domainname/namespace/imagename:tag. To follow this example, use registry-vpc.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go:73fbdd56 (replace cn-hangzhou with your region).
    Access Protocol The protocol for the Service. Supported values: HTTP and gRPC.
    Container Port The container port to expose. Valid range: 1–65535.
    Advanced Click Advanced to configure scaling, resources, lifecycle, environment variables, and volumes. See the table below.

    Advanced settings:

    Setting Description
    Internal Access Only Restricts access to within the cluster. The Service is not accessible over the internet.
    Maximum Concurrent Requests Maximum concurrent requests per container. Default: 0 (unlimited).
    Minimum Pods Minimum pods to keep running when no requests are received. Set to 0 to enable scale-to-zero.
    Maximum Pods Maximum pods allowed when scaling out.
    Resource Limit Upper limits for CPU (in cores), memory (in bytes or mebibytes), and GPU resources.
    Lifecycle Container Command and Parameter. If left blank, the image defaults are used. If only Parameter is set, the image's default Command and the specified Parameter are used. If both are set, the image defaults are overwritten.
    Environment Variables Key-value pairs injected into the container as environment variables.
    Volume Mount local storage (HostPath, ConfigMap, Secret, or EmptyDir) or a persistent volume claim (PVC) to a path in the container. To add cloud storage, select Add PVC.

Use the YAML editor

  1. On the Services tab, click Create from YAML in the upper-right corner.

  2. Paste your YAML content into the editor and click Create. The following example creates a Knative Service named helloworld-go:

    apiVersion: serving.knative.dev/v1
    kind: Service
    metadata:
      name: helloworld-go
    spec:
      template:
        spec:
          containers:
          - image: registry-vpc.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go:73fbdd56  # Replace the region with your actual one.
            env:
            - name: TARGET
              value: "Knative"

After creation, view, update, or delete the Service from the Services tab.

Step 2: Access the Knative Service

After deployment, access the Service by mapping its domain name to the gateway IP address.

  1. On the Services tab, click the name of the Service. In the Basic Information section, note the gateway IP address and the domain name assigned to the Service.新服务

  2. Add an entry to your local hosts file to point the Service's domain name to the gateway IP address. For example:

    121.xx.xxx.xx helloworld-go.default.example.com
  3. After you modify the hosts file, use the domain name to access the Knative Service.访问服务

What's next