This topic describes how to create a Knative Service in the Container Service for Kubernetes (ACK) console.
Create a Knative Service
- Log on to the ACK console.
- In the left-side navigation pane, choose .
- In the upper-right corner of the Knative Services page, click Create Service.
- Configure the Knative Service.
Parameter Description Cluster The cluster where the Knative Service is deployed. Namespace The namespace where the Knative Service is deployed. Service Name The name of the Knative Service. Image Name
To select an image, cick Select Image. In the dialog box that appears, select an image and click OK. You can also enter the address of a private image registry. The registry address must be in the domainname/namespace/imagename:tag format. In this example, registry.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go is used.
Click Select Image Version and select an image version. 73fbdd56 is selected in this example.
HTTP and gRPC are supported.
The container port that you want to open. Enter a port number from 1 to 65535.
Internal Access Only
If you select Internal Access Only, the Knative Service cannot be accessed over the Internet.
Maximum Concurrent Requests
The maximum number of concurrent requests that are supported by the container. The default value is 0. This indicates that the number of concurrent requests is unlimited.
The minimum number of pods that are kept running when no request is received. If you set the parameter to 0, the number of running pods is reduced to 0 when no request is received.
The maximum number of pods that are kept running when no request is received.
The maximum amount of CPU and memory resources that can be allocated to the Knative Service. This prevents the Service from occupying excessive resources. CPU resources are measured in cores. Memory resources are measured in bytes or MiB.
LifecycleYou need to specify the command and arguments based on the following descriptions:
- If no command or argument is specified, the default command and arguments of the image are used.
- If you specify only arguments, the default command of the image and the specified arguments are used.
- If you specify both the command and arguments, the default configurations of the image are overwritten.
Set environment variables in key-value pairs.
Volume You can mount local storage volumes and persistent volume claims (PVCs) to the container.
- Local Storage: You can select hostPath, ConfigMap, Secret, or EmptyDir. The volume is mounted to a path in the container. For more information, see Volumes.
- PVC: Select Cloud Storage.
- Click Create.
Access a Knative Service
After the Knative Service is created, map the domain name of the Knative Service to the IP address of the access gateway. Then, you can use the domain name to access the Knative Service. Procedure:
- Go the details page of the cluster where the Knative Service is deployed. In the left-side
navigation pane, choose . On the Knative Services page, find and click the newly created Knative Service.In the Basic Information section of the details page of the Knative Service, you can view detailed information about the access gateway and domain.
- Add the following information to the Hosts file on your on-premises machine to map
the domain name of the Knative Service to the IP address of the gateway. Example:
- After you modify the Hosts file, access the Knative Service by using the domain name.