This topic describes how to use Knative to deploy an application.

Prerequisites

Procedure

  1. Log on to the Container Service console.
  2. In the left-side navigation pane under Container Service-Kubernetes, choose Knative > Services.
  3. In the upper-righter corner, click Create Service.
  4. Set the following parameters:
    • Service Name: Set the service name. In this example, the service name is set as helloworld-go.
    • Image Name: Select an image by clicking Select Image, or in the box, enter a private registry that must be in the format of domainname/namespace/imagename:tag.
      Note In this example, the registry registry.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go is used.
    • Image Version: Select an image by clicking Select Image Version, or in the box, enter an image version. By default, if you do not set this parameter, the latest image version is used. In this example, the image version is set as 73fbdd56.
    • Environment Variables: Set an environment variable by entering a key-value pair. In this example, the environment variable is set as TARGET=Knative.
  5. Click Create.

    On the Knative Service Manage page, the created service is then displayed.

Verify the result

To access the created Knative service through its URL, follow these steps:
  1. In the left-side navigation pane under Container Service-Kubernetes, choose Knative > Component to view the IP address of the gateway of the Knative service.
  2. In the host file of your local host, associate the IP address of the gateway and the domain name of the Knative service with your local host by adding the following information:
    the IP address of the gateway + the domain name
    The following is a sample:
    47.95.XX.XX helloworld-go.default.example.com
  3. In your browser, enter the URL http://helloworld-go.default.example.com to access the Knative service.
    Access the service