You can use Knative to deploy serverless applications with a few clicks. In the following example, a "Hello, World!" application is deployed.
- Log on to the ACK console.
- In the left-side navigation pane, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
- In the left-side navigation pane of the details page, choose .
- In the upper-right corner of the Services tab, click Create Service.
- On the Create Service page, set the Cluster, Namespace, and Service Name parameters. Then, select an image and image version.
Parameter Description Service Name Enter a name for the Service. helloworld-go is used in this example. Image Name To select an image, click Select Image. In the dialog box that appears, select an image and click OK. You can also enter the address of an image in a private image registry. The image address must be in the following format: domainname/namespace/imagename:tag. In this example, registry.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go is used. Image Version Click Select Image Version to select an image version. If you do not set this parameter, the latest version is used. In this example, 73fbdd56 is selected. Environment Variables Set environment variables in key-value pairs. In this example,
For more information about how to set other parameters, see Parameter descriptions.
- Click Create. After you create the Service, the Service is displayed on the Services tab.
Access the Knative Service
After the Knative Service is deployed, you can point its domain name to the IP address of the gateway that is associated with the Service. This allows you to access the Knative Service through its URL.
- In the left-side navigation pane of the ACK console, choose Knative Components page. On the Knative Components page, you can view the gateway of the Knative Service. to go to the
- Add the following information to the hosts file to point the domain name of the Service
to the IP address of the gateway:
Gateway IP address + Domain name
- After you modify the hosts file, enter http://helloworld-go.default.example.com into the address bar of the browser to access the Service.