All Products
Search
Document Center

Container Service for Kubernetes:Use the ACK console to deploy a magic cube game

Last Updated:Mar 26, 2024

Container Service for Kubernetes (ACK) (ACK) allows you to manage containerized applications that run on the cloud in a convenient and efficient manner. This topic describes how to use the ACK console to deploy, expose, and monitor a magic cube game in an ACK cluster.

Background information

  • This topic demonstrates how to deploy an ack-cube application in an ACK Pro cluster by using a container image. This application is an online magic cube game. After you perform the steps in this topic, a magic cube game is deployed in an ACK Pro cluster.cube

  • Both ACK Basic clusters and ACK Pro clusters are ACK managed clusters. Compared with ACK Basic clusters, ACK Pro clusters created in this topic feature higher reliability and security and are covered by the SLA that supports compensation clauses. For more information about the billing of ACK clusters and the cloud resources used by ACK clusters, see Billing.

  • For more information about the terms used in Kubernetes, see Terms.

Procedure

Manual deployment

workflow

If this is the first time you use ACK, you must activate ACK and grant ACK the permissions to access cloud resources. Then, create an ACK cluster and deploy a magic cube game in the cluster.

Step 1: Activate and grant permissions to ACK

If this is the first time you use ACK, you must activate ACK and grant ACK the permissions to access cloud resources.

  1. Go to the Container Service for Kubernetes page.

  2. Read and select Container Service for Kubernetes Terms of Service, and then click Activate Now.

  3. Log on to the ACK console.

  4. On the Container service needs to create default roles page, click Go to RAM console. On the Cloud Resource Access Authorization page, click Confirm Authorization Policy.

    After you assign the Resource Access Management (RAM) roles to ACK, log on to the ACK console again to get started with ACK. If you have other problems during the authorization process, see FAQ about authorization management

Step 2: Create an ACK Pro cluster

This step shows how to create an ACK Pro cluster. Default settings are used for most cluster parameters. For more information about the cluster parameters, see Create an ACK Pro cluster.

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. In the upper-right corner of the Clusters page, click Create Kubernetes Cluster.

  3. On the Managed Kubernetes tab, set cluster parameters as described in the following table. Use default settings for the parameters that are not included in the table.

    Parameter

    Description

    Example

    Cluster Name

    Enter a name for the cluster.

    ACK-Demo

    Cluster Specification

    Select a cluster type. You can select Professional or Basic. We recommend that you use ACK Pro clusters in the production environment and test environment. ACK Basic clusters can meet the learning and testing needs of individual users.

    For more information about ACK Pro clusters, see Overview of ACK Pro clusters.

    Professional

    Region

    Select a region to deploy the cluster.

    China (Beijing)

    VPC

    ACK clusters can be deployed only in virtual private clouds (VPCs). You must specify a VPC in the same region as the cluster.

    In this example, click Create VPC and create a VPC named vpc-ack-demo in the China (Beijing) region. For more information, see Create and manage a VPC.

    vpc-ack-demo

    vSwitch

    Select vSwitches for nodes in the cluster to communicate with each other.

    In this example, click Create vSwitch and create a vSwitch named vswitch-ack-demo in the vpc-ack-demo VPC. Then, select vswitch-ack-demo in the vSwitch list. For more information, see Create and manage a vSwitch.

    vswitch-ack-demo

    Access to API Server

    Specify whether to expose the Kubernetes API server of the cluster to the Internet. If you want to manage the cluster over the Internet, you must expose the Kubernetes API server with an elastic IP address (EIP).

    In this example, Expose API Server with EIP is selected.

  4. Click Next:Node Pool Configurations. Configure the following parameters as described. Use default settings for the parameters that are not included in the table.

    Parameter

    Description

    Example

    Instance Type

    Select instance types that are used to deploy nodes.

    You can specify the number of vCores and the amount of memory to filter the instance types. You can also specify an instance type in the search box to search for the instance type.

    To ensure the stability of the cluster, we recommend that you select instance types with at least 4 vCores and 8 GiB of memory. For more information about Elastic Compute Service (ECS) instance types and how to select instance types, see Suggestions on choosing ECS specifications for ACK clusters and Overview of instance families.

    Instance types with at least 4 vCores and 8 GiB of memory

    Quantity

    Specify the number of worker nodes.

    2

    System Disk

    Set the system disk for nodes.

    In this example, enhanced SSD (ESSD) is selected as the disk type and the disk size is set to 40 GiB.

    Logon Type

    Select the logon type for nodes.

    In this example, password logon is selected as the logon type and a password is specified.

  5. Click Next:Component Configurations. Use default settings for all component parameters.

  6. Click Next:Confirm Order, read and select the ACK terms of service, and then click Create Cluster.

    Note

    It requires approximately 10 minutes to create a cluster. After the cluster is created, you can view the cluster on the Clusters page.

Step 3: Create and expose an application

This step shows how to deploy a stateless application by using a Deployment and how to expose the application to the Internet. The application is a magic cube game. For more information about the parameters used to create a Deployment, see Create a stateless application by using a Deployment.

  1. On the Clusters page, click the name of the ACK-Demo cluster.

  2. In the left-side navigation pane of the details page, choose Workloads > Deployments.

  3. In the upper-right corner of the Deployments page, click Create from Image.

  4. On the Basic Information wizard page, set the application name to ack-cube.

  5. Click Next. On the Container wizard page, set container parameters.

    图片 1.png

    Parameter

    Description

    Example

    Image Name

    Enter an image name.

    In this example, registry.cn-hangzhou.aliyuncs.com/acr-toolkit/ack-cube:1.0 is specified.

    Resource Limit

    Specify the resource limits of the application. This prevents the application from occupying excessive amounts of resources.

    In this example, 1 vCore and 1,024 MiB of memory are specified. Ephemeral Storage is left empty.

    Required Resources

    Specify the amount of resources that are reserved for the application. This prevents application unavailability caused by insufficient resources.

    0.5 In this example, 0.5 vCores and 512 MiB of memory are specified. Ephemeral Storage is left empty.

    Port

    Configure container ports.

    In this example, TCP port 80 is configured and named ack-cube.

  6. Click Next. On the Advanced wizard page, click Create to the right side of Services.

  7. In the Create Service dialog box, set Service parameters and click Create. This creates a Service to expose the ack-cube application.

    service

    Parameter

    Description

    Example

    Name

    Enter a name for the Service.

    ack-cube-svc

    Type

    The type of Service. This parameter specifies how the Service is accessed. Choose Server Load Balancer > Public Access > Create SLB Instance. You can click Modify to change the Server Load Balancer (SLB) instance specification based on your business requirements.

    In this example, the default specification Small I (slb.s1.small) is used.

    Port Mapping

    Specify a Service port and a container port. The container port must be the same as the one that is exposed in the backend pod.

    In this example, the Service port and container port are both set to 80.

  8. In the lower-right corner of the Advanced wizard page, click Create.

    After the application is created, you are redirected to the Complete wizard page. You can find the resource objects included in the application and click View Details to view application details.succeed

Step 4: Test access to the application

This step shows how to access the application by using the Service.

  1. On the Clusters page, click the name of the ACK-Demo cluster.

  2. On the Clusters page, click the name of the cluster that you want to manage and choose Workloads > Deployments in the left-side navigation pane.

  3. Click ack-cube on the Deployments page.

  4. Click the Access Method tab, find the ack-cube-svc Service, and click the IP address in the External Endpoint column to start the magic cube game.4.jpg

Quick deployment

  1. Click the Quick configuration link to go to the Resource Orchestration Service (ROS) console. The Create Stack page appears. In the upper part of the page, select the region where you want to create a stack. In this example, China (Hohhot) is selected. Set other parameters and click Create.

    Parameter

    Description

    Example

    Stack Name

    You can enter a custom stack name.

    stack_2023-06-12_cBesTX8FB

    Cluster Name

    You can enter a custom stack name.

    Note

    You cannot specify the name of an existing cluster.

    ack-demo-cube

    vSwitch Available Zone

    Select a zone.

    Zone A

    Instance Type

    Select an instance family.

    You can filter instance types by the number of vCores and memory size. You can also set the Architecture and Type parameters to filter instance types.

    g6, general-purpose instance family

    Worker System Disk Category

    Select a system disk type for nodes.

    The available disk types vary based on the instance type that you select. For more information about the disk types supported by different instance types, see Overview of instance families. Disk types that are not displayed in the drop-down list are not supported by the instance types that you select.

    cloud_ssd

    Instance Password

    Enter a password that is used to log on to the nodes.

    Enter a password.

    • If Created is displayed in the Status parameter on the Stack Information tab, the stack is created.

    • If Created is not displayed in the Status parameter on the Stack Information tab, the stack is not created. You can click Quick Diagnostics to view the diagnostic details.

  2. Test access to the application.

    Wait until Created is displayed in the Status parameter on the Stack Information tab. Then, click the Outputs tab on the right of the Stack Information tab. Click the hyperlink next to CubeAddress to access the magic cube game.资源栈.jpeg

Release resources

You are charged a cluster management fee and a cloud service fee for the ACK Pro cluster that you use. The cluster management fee is charged by ACK. The cloud service fee is charged by the cloud services used by the ACK Pro cluster. Take note of the following items after you create an ACK Pro cluster.

  • If you no longer need to use the cluster, go to the Clusters page in the ACK console, find the cluster, and then choose More > Delete in the Actions column. In the Delete Cluster page, select Delete ALB Instances Created by the Cluster, Delete Alibaba Cloud DNS PrivateZone instances Created by the Cluster, Delete Associated Log Service Project, and I understand the above information and want to delete the specified cluster. Then, click OK. For more information about how to delete an ACK Pro cluster, see Delete ACK clusters.

  • If you need to keep the cluster, top up your account once your account balance is less than CNY 100. For more information about the billing rules of Alibaba Cloud services, see Cloud service fee.

References

  • To enable auto scaling for application pods, you can configure the Horizontal Pod Autoscaler (HPA), Cron Horizontal Pod Autoscaler (CronHPA), and Vertical Pod Autoscaler (VPA). For more information, see Auto scaling overview.

  • In addition to exposing applications through Services, you can use Ingresses to enable application traffic routing at Layer 7. For more information, see Create an NGINX Ingress.

  • In addition to monitoring container performance, you can monitor the cluster infrastructure, application performance, and operations on your workloads. For more information, see Observability overview.

  • If you want to view monitoring information about applications, go to the cluster details page and choose Operations > Prometheus Monitoring in the left-side navigation pane. On the Prometheus Monitoring page, you can view monitoring information such as CPU utilization, memory utilization, and network I/O.