All Products
Search
Document Center

Compute Nest:Create and update a service using a container deployment package

Last Updated:Aug 24, 2026

This topic shows service providers how to use a container image within a deployment package to create a service. Customers can then use this service to create and update service instances.

Prerequisites

  1. This example deploys container resources to an ACK cluster, so you must have an available ACK managed cluster. For more information, see Create an ACK managed cluster.

  2. This example demonstrates the deployment package upgrade process by using an Nginx image. You will upgrade the image from nginx 1.7 to nginx 1.8. Pull both image versions to your local machine.

    docker pull nginx:1.7
    docker pull nginx:1.8

Procedure

5.png

Step 1: Create and publish a deployment package

Before you create a service, you must create and publish a deployment package.

  1. Log on to the Compute Nest console.

  2. In the left-side navigation pane, choose Service Deployment Package. On the Packages tab, click Create Deployment Package.

  3. On the Create Deployment Package page, complete the Basic Information. Then, follow the on-screen instructions to obtain an access credential and push the nginx:1.7 image.

    For Deployment Package Name, enter Container Deployment Package Upgrade Demo. For Deployment Package Version Name, enter Nginx1.7. In the deployment package content section, select the Container Image tab. After you log in, tag, and push the image, select nginx in the Select Image field and 1.7 for the version. Then, click Publish Deployment Package.

  4. Click Publish Deployment Package.

    On the Deployment package management page, you can click the deployment package name to go to its details page. After the package is published, the deployment package status is Available and the type is container image. On the Deployment package versions tab, you can view the information about the published version, including the version name, status, content, creation time, distribution regions, and security scan results. A status of Available indicates a successful publication.

Step 2: Create a service

  1. Log on to the Compute Nest console.

  2. In the left-side navigation pane, choose My Services. On the My Services page, select the Created Services tab and then click Create Service.

  3. On the Create Service page, configure the required parameters.

    This section describes only the parameters that require special configuration for this example. For information about other parameters, see Create a private service.

    1. In the Template area, for Template Content, enter the service template to create a single ECS instance from a custom image. For the template content, see Template Example.

    2. In the Deployment Package Association section, configure the container image association.

      Associate the deployment package that you created, selecting its first version. Set Deployment Timeout to 7200 seconds.

  4. Click Save Service.

  5. Test the service.

    After you save the service, you must test it to ensure that it functions as expected. For more information, see Test a service.

  6. Publish the service.

    After the service passes testing, submit it for review. Once approved, you can publish the service. For more information, see Publish a service.

Step 3: Create and view a service instance

  1. Create a service instance.

    For more information, see Create a private service instance.

  2. View the version information of the service instance.

    In the Compute Nest console, find the service instance that you created and click the service instance ID to go to the details page. On the Overview tab, in the Service information section, verify that the service version is 1.

  3. In the Container Service for Kubernetes (ACK) console, view the container image information. On the Stateless Deployment page, you can see that a Deployment named nginx is successfully deployed. Its namespace corresponds to the service instance, its label is app:nginx, the pod count is 1/1, and the image version is nginx:1.7. This confirms that the service instance is deployed and running correctly.

Step 4: Update the deployment package

  1. Log on to the Compute Nest console.

  2. In the left-side navigation pane, choose Service Deployment Package to go to the Deployment package management page.

  3. Find the deployment package that you created and click Create Version to go to the Create Version page. Obtain an access credential and push the nginx:1.8 image. On the Create Deployment Package page, in the Deployment Package Information section, set Deployment Package Name (for example, Container Deployment Package Upgrade Demo), Deployment Package Version Name (for example, Nginx1.8), and Deployment Package Description. In the Deployment Package Content section, select the Container Image tab, and run the docker login, docker tag, and docker push commands provided on the page to push the image to the Compute Nest image repository. Then, in Select Image, select the target image and image version (for example, nginx and 1.8).

  4. Click Publish Deployment Package.

Step 5: Update the service

  1. Log on to the Compute Nest console.

  2. Find the service to update and click Create Version. On the Create Version page, update the parameters.

    This section describes only the parameters that require special configuration for updating the image. For information about other parameters, see Update a service.

    1. In the Deployment Package Association section, under Set Container Image Association, change the associated image to the new version from the updated deployment package. In the Select Deployment Package (Container Image Association) dialog box, the association identifier is {{ computenest::acrimage::nginx }}, which means you can select only deployment packages of the container image type. From the left drop-down list, select the deployment package (for example, Container Image Deployment Package Test). From the right drop-down list, select the corresponding version (for example, Version 1). Enter a description as needed, and click OK.

    2. In the Configurations section, under Upgrade Parameters, configure the upgrade settings.

      Parameter

      Example value

      Support for upgrade

      Allow customers to upgrade service instances

      Support for rollback

      Allow customers to roll back service instances

      Upgrade description

      Nginx version 1.8

      Upgradeable versions

      All Versions

      Components to upgrade

      Service Configurations

  3. Click Submit Review.

Step 6: Upgrade the service instance

  1. Log on to the Compute Nest console.

  2. In the left-side navigation pane, choose Service Instance.

  3. Click the service instance ID to open its details page. In the upper-right corner, click Upgrade Service Instance to open the Upgrade Service Instance dialog box.

  4. Select an upgrade version, and then click Start Upgrade. In the Upgrade Version drop-down list, select the target version and click Start Upgrade.

Step 7: Verify the upgraded service instance

  1. Log on to the Compute Nest console.

  2. In the left-side navigation pane, click Service Instance.

  3. Find the service instance that you created and click the service instance ID to open the service instance details page, and then check whether the service instance version is updated. In the Alibaba Cloud Container Service for Kubernetes (ACK) console, check whether the Nginx image is updated. In the Service information section, verify that Service version is 2, Version description is Container Deployment Package Upgrade Demo nginx1.8, and Service type is Managed.

Sample template

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: A simple demo that deploys a MySQL and a container-based app into ack. 
  zh-cn: 在ACK中部署容器应用和MySQL。
Parameters:
  ClusterId:
    Type: String
    Description:
      en: >-
        The ID of the Kubernetes cluster where the application is deployed.
      zh-cn: >-
        部署应用程序的K8s集群ID
    AllowedPattern: '[0-9a-z]+$'
    Label:
      en: Kubernetes ClusterId
      zh-cn: K8s集群ID
    ConstraintDescription:
      en: >-
        The cluster ID must consist of lowercase letters or numbers.
      zh-cn: '集群ID必须由小写字母或者数字组成'
Resources:
  ClusterApplication:
    Type: ALIYUN::CS::ClusterApplication
    Properties:
      ClusterId:
        Ref: ClusterId
      DefaultNamespace:
        Ref: ALIYUN::StackName
      YamlContent: |
        apiVersion: v1
        data:
          .dockerconfigjson: {{ computenest::acr::dockerconfigjson }}
        kind: Secret
        metadata:
          name: computenest
        type: kubernetes.io/dockerconfigjson
        ---
        apiVersion: apps/v1
        kind: Deployment
        metadata:
          name: nginx
          labels:
            app: nginx
        spec:
          replicas: 1
          selector:
            matchLabels:
              app: nginx
          template:
            metadata:
              labels:
                app: nginx
            spec:
              containers:
              - name: nginx
                image: {{ computenest::acrimage::nginx }}
                ports:
                - containerPort: 80
              imagePullSecrets:
              - name: computenest
        ---
        apiVersion: v1
        kind: Service
        metadata:
          labels:
            app: nginx
          name: nginx-svc
        spec:
          ports:
          - port: 80
            protocol: TCP
            targetPort: 80
          selector:
            app: nginx
          type: LoadBalancer
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - ClusterId
        Label:
          en: ACK Configuration
          zh-cn: ACK参数配置