The Container Service for Kubernetes (ACK) console provides extensive features to help you manage and maintain clusters and applications. This topic describes how to deploy an NGINX application, configure an Ingress, and query log data in the ACK console.
Prerequisites
Step 1: Deploy an NGINX application
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and choose in the left-side navigation pane.
On the Deployments page, click Create from YAML in the upper-right corner. Then, configure the parameters and click Create.
In the upper part of the page, set Namespace to default and Sample Template to Resource - basic Deployment.
Configure log collection. For more information about how to configure log collection parameters, see Collect log data from containers by using Simple Log Service.
Add the following content to the
spec
field in the template.NoteIn the following sample code,
aliyun_logs_log-nginxvarlog
specifies that the name of the created Logstore is log-nginxvarlog. The value stdout specifies that the Logstore collects standard outputs of containers from the specified path.env: - name: aliyun_logs_log-nginxvarlog value: stdout
Change the version of the image that is used to deploy the NGINX application to 1.9.1.
After the NGINX application is created, you can click the icon in the upper-left corner of the page to view the application on the Deployments page.
Step 2: Create a Service and release the NGINX application
In the left-side navigation pane of the details page, choose
On the Services page, click Create in the upper-right corner. In the Create Service dialog box, configure the parameters and click Create.
Parameter
Description
Example
Name
Enter a name for the Service.
nginxservice
Type
Multiple types are supported. In this case, set Type to Cluster IP.
Cluster IP
Backend
Select nginx-deployment-basic from the drop-down list.
nginx-deployment-basic
Port Mapping
Enter a name for the port. Set Service Port to 80, Container Port to 80, and Protocol to TCP.
test
80
80
TCP
Step 3: Create an NGINX Ingress to expose the NGINX application
In the left-side navigation pane of the details page, choose .
On the Ingresses page, click Create Ingress.
Set Gateway Type to Nginx, configure the Ingress as described in the following section, and then click OK.
The following section describes only the key parameters. For more information about how to configure other parameters, see Create an NGINX Ingress.
Name: Enter a name for the Ingress. The name is set to ingress-demo in this example.
Rules: Leave the Domain Name parameter empty, set Path to
/
, use the default match rule, use the nginxservice Service that you created in Step 2, and set Port to 80.
Wait about 1 minute. The Ingress IP address is displayed in the Endpoint column of ingress-demo on the Ingresses page Enter the Ingress IP address into the address bar of the browser. If the following page is displayed, the Ingress is created.
Step 4: View the access log of the NGINX application
After the NGINX application is released and exposed, the NGINX Ingress controller allows you to stream all HTTP request log data to standard outputs. You can view the access log of the NGINX application and monitor the real-time status of the NGINX Ingress in the Simple Log Service console.
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage and click Cluster Information in the left-side navigation pane.
On the page that appears, click the Cluster Resources tab, find Log Service Project, and then click its ID to check the Logstore.
On the Logstores tab, select log-nginxvarlog to view the latest access log of the application.