Creating and managing deployment scenarios
  • PDF

Creating and managing deployment scenarios

  • PDF

Available in Classic and VPC

Creating and managing deployment scenarios explains how to create and manage deployment scenarios for each deployment target.

Note

To create and manage deployment scenarios, a customer account or a sub account with the changeProject permission is required. For how to set permissions, refer to Sub Account Guide.

There are different methods of creating deployment scenarios, depending on the deployment target.

See the creation method for the deployment scenario's deployment target you want to create.

Create Server deployment scenario

The following describes how to create a deployment scenario with Server as a deployment target.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  3. Click a deployment project where you want to create the scenario, and then click a deployment stage with Server as a deployment target.
  4. Click the [Create] button.
  5. When the deployment scenario creation page appears, proceed with the following steps in order.

1. Basic settings

Enter the deployment scenario's name and description, and then click the [Next] button.

2. Set up deployment strategy

Select the deployment strategy and process, and then click the [Next] button.
sourcedeploy-use-scenario_strategy_ko

  • Only the basic deployment strategy is provided. Deploy on the deployment server set.
  • Deployment process options available are consecutive deployment and simultaneous deployment.
    • Consecutive deployment: Perform a consecutive deployment for the specified deployment server.
    • Simultaneous deployment: Perform a simultaneous deployment for the specified deployment server.

3. Set up deployment file

Select the deployment file location and build project, and then click the [Next] button.
sourcedeploy-use-scenario_file_ko

  • The available options for deployment file location are Source build, Object Storage, and Set later.
    • If you've selected Source build, then select a build project. If the last build result is a fail or the build output is not uploaded, then the deployment is not performed.
    • If you've selected Object Storage, then select a deployment file from the buckets in your Object Storage. Only the deployment file compressed as a .zip file can be deployed.
    • If you've selected Set later, then you can set up the deployment file when deploying the scenario.

4. Set up deployment commands

sourcedeploy-use-scenario_command_ko

  • You can add multiple commands, which will be executed in the order they were added.
  • Run before deployment: Set up the command to run in the server before the deployment, and then click the [Add] button.
    • Account for execution: Enter the server account to run the command.
    • Command for execution: Enter the command to run on the server.
  • File deployment: Set up the path to deploy the file, and then click the [Add] button.
    • Source file path: Enter the file path to deploy.
    • deployment path: Enter the entire path of the server to deploy.
    • If you've set the deployment file location to Set later in 3. Set up deployment files, or if there's no last build output from SourceBuild, then Set later or No last build output is displayed in File deployment.
  • Run after deployment: Set up the command to run in the server after the deployment, and then click the [Add] button.
    • Account for execution: Enter the server account to run the command.
    • Command for execution: Enter the command to run on the server.
  • Click the [Delete] button to delete the added command.
  • Click Use to select it if you'd like to use the rollback feature in case of failed deployment.
    • If the rollback feature is enabled, then the deployment is automatically rolled back to the previous version when it fails.
    • Rollback is performed by running the last successful deployment of the stage.
    • If the previous deployment file does not exist in Object Storage or there is no last successful deployment, then the rollback fails.

5. Final confirmation

Check the information for the deployment scenario configured, and then click the [Create deployment scenario] button.

Create Auto Scaling deployment scenario

The following describes how to create a deployment scenario with Auto Scaling as a deployment target.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  3. Click a deployment project where you want to create the scenario, and then click a deployment stage with Auto Scaling as a deployment target.
  4. Click the [Create] button.
  5. When the deployment scenario creation page appears, proceed with the following steps in order.

1. Basic settings

Enter the deployment scenario's name and description, and then click the [Next] button.

2. Set up deployment strategy

Select the deployment strategy and process, and then click the [Next] button.
sourcedeploy-use-scenario_strategy3_ko

  • Deployment strategy options available are basic and blue/green.

    Note

    Only the basic option is provided in the Classic environment. The basic and blue/green options are both provided in the VPC environment.

    • Basic: Perform consecutive deployment for servers in the specified Auto Scaling Group.
    • Blue/Green: Copy the specified Auto Scaling Group to create a new Auto Scaling Group, and then perform deployment to the group.
      • Once the deployment is successfully completed, the server in the new Auto Scaling Group is connected to the Load Balancer's target group, and then the traffic is routed to the group. The interruption time due to deployment can be minimized with the blue/green strategy.
  • Deployment process options available are consecutive deployment and simultaneous deployment.

    • Consecutive deployment: Perform a consecutive deployment for the specified deployment server.
    • Simultaneous deployment: Perform a simultaneous deployment for the specified deployment server.
  • If you've selected the blue/green deployment strategy, then set up the following.

    • Select a Load Balancer target group to connect to the new Auto Scaling Group.
      • You can choose from a list of target groups connected to the Auto Scaling Group specified as the deployment target.
      • Click the [Check status] button to see the target's health check status.
    • After the blue/green deployment completion, select whether to delete and terminate the existing Auto Scaling Group.
      • Maintain: The existing Auto Scaling Group won't be terminated, even after the completion of the blue/green deployment.
      • Delete and terminate: After completing the blue/green deployment, terminate the existing Auto Scaling Group. Automatically terminate the servers in the existing Auto Scaling Group as well.
    • If you've chosen to maintain the existing Auto Scaling Group, then select how to handle servers in the existing Auto Scaling Group after completing the blue/green deployment.
      • Maintain: After the blue/green deployment is completed, the servers in the existing Auto Scaling Group are not terminated, but they're disconnected from the Load Balancer target group.
      • Terminate: After the blue/green deployment completion, automatically terminate servers in the existing Auto Scaling Group.

3. Set up deployment file

Select the deployment file location and build project, and then click the [Next] button.
sourcedeploy-use-scenario_file_ko

  • The available options for deployment file location are Source build, Object Storage, and Set later.
    • If you've selected Source build, then select a build project. If the last build result is a fail or the build output is not uploaded, then the deployment is not performed.
    • If you've selected Object Storage, then select a deployment file from the buckets in your Object Storage. Only the deployment file compressed as a .zip file can be deployed.
    • If you've selected Set later, then you can set up the deployment file when deploying the scenario.

4. Set up deployment commands

Set the deployment commands, and then click the [Next] button.

sourcedeploy-use-scenario_command_ko

  • You can add multiple commands, which will be executed in the order they were added.
  • Run before deployment: Set up the command to run in the server before the deployment, and then click the [Add] button.
    • Account for execution: Enter the server account to run the command.
    • Command for execution: Enter the command to run on the server.
  • File deployment: Set up the path to deploy the file, and then click the [Add] button.
    • Source file path: Enter the file path to deploy.
    • deployment path: Enter the entire path of the server to deploy.
    • If you've set the deployment file location to Set later in 3. Set up deployment files, or there's no last build output from SourceBuild, then Set later or No last build output is displayed in File deployment.
  • Run after deployment: Set up the command to run in the server after the deployment, and then click the [Add] button.
    • Account for execution: Enter the server account to run the command.
    • Command for execution: Enter the command to run on the server.
  • Click the [Delete] button to delete the added command.
  • Click Use to select it if you'd like to use the rollback feature in case of failed deployment.
    • If the rollback feature is enabled, then the deployment is automatically rolled back to the previous version when it fails.
    • Rollback is performed by running the last successful deployment of the stage.
    • If the previous deployment file does not exist in Object Storage or there is no last successful deployment, then the rollback fails.

5. Final confirmation

Check the information for the deployment scenario configured, and then click the [Create deployment scenario] button.

Create Kubernetes Service deployment scenario

The following describes how to create a deployment scenario with Kubernetes Service as a deployment target.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  3. Click a deployment project where you want to create the scenario, and then click a deployment stage with Kubernetes Service as a deployment target.
  4. Click the [Create] button.
  5. When the deployment scenario creation page appears, proceed with the following steps in order.

1. Basic settings

Enter the deployment scenario's name and description, and then click the [Next] button.

2. Manifest settings

Click the [Next] button after setting the repository and path where the manifest file is.

sourcedeploy-use-scenario_manifest_ko

  • Select a repository and branch you own in SourceCommit.
  • Enter the manifest file's path to deploy, and then click the [Add] button.
    • You can delete the added path by clicking the [Delete] button.
Note
  • To deploy objects to a Kubernetes Service cluster, you need to create a manifest, and the manifest to be used for the deployment should be stored in a SourceCommit repository.

  • You don't have to create a new manifest file for blue/green or canary updates. New objects required for blue/green or canary are deployed automatically by SourceDeploy.

  • Refer to the following example for manifest creation.
    Previously deployed Kubernetes objects (kind: Deployment, name: sampleapp, namespace: dev)
    sourcedeploy-use-scenario_manifest

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: sampleapp
      namespace: dev
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: test
      template:
        metadata:
          labels:
            app: test
        spec:
          containers:
            - image: 'example-dev.kr.ncr.ntruss.com/nodejs_dockerbuild:latest'
              imagePullPolicy: Always
              name: sampleapp
              ports:
                - containerPort: 3000
          imagePullSecrets:
            - name: pub
    

3. Set up deployment strategy

Select a deployment strategy, and then click the [Next] button.

sourcedeploy-use-scenario_strategy2_ko

  • Rolling: New objects are deployed if there are no previously deployed objects.
    • When you deploy new objects, rather than updating objects, select Rolling.
  • Blue/Green/Canary: The deployment will fail if there are no previously deployed objects.
    • You can't deploy new objects with the blue/green or canary strategy.
    • When deploying with the blue/green strategy, a new version (green) of objects are deployed, so the object names are changed. Even if the object names are changed, you can continue to deploy through SourceDeploy without editing the manifest files. However, if an object with an existing name is created with the manual deployment through kubectl apply, etc., using the manifest file, then you can't deploy continuously through SourceDeploy because the object to be updated can't be specified.
  • If you've selected the canary deployment strategy, then refer to Canary manual analysis settings and Canary automatic analysis settings, depending on the analysis method.

Canary manual analysis settings

sourcedeploy-use-scenario_canary_ko

  • Number of baseline and canary pods: Enter the number of replicas to be applied to applications that are the baseline or canary version.
    • The number can range between 1 and 10.
  • Canary analysis method: Select Manual.
    • The user manually analyzes the baseline and canary versions of the application to determine whether to approve or cancel the deployment.
  • Time out: Enter the maximum time for the user to determine to proceed or cancel a canary deployment.
    • It can range between 1 and 360 minutes.
    • If the set time is exceeded, then the deployment is automatically canceled, and the baseline and canary applications will be closed.

Canary automatic analysis settings

sourcedeploy-use-scenario_canary2_ko

  • Number of baseline and canary pods: Enter the number of replicas to be applied to applications that are the baseline or canary version.
    • The number can range between 1 and 10.
  • Select Canary analysis method as Automatic.
    • The baseline and canary versions of the application are analyzed automatically to determine whether to deploy according to the analysis result.
  • Prometheus URL: Enter the Prometheus endpoint for requesting the Prometheus collection log.
    • Prometheus must be installed in the Kubernetes Service cluster to analyze the application automatically.
    • Set the endpoint as a public IP so that SourceDeploy can access it.
      • Set the Prometheus service as the Load Balancer type.
  • Analysis environment variable: Enter the variable for distinguishing between baseline and canary when performing Prometheus analysis.
    • It can be used as ${basecanary} in a PromQL statement.
    • Analysis environment variables are specified as ncp_sourcedeploy_canary="baselineenv"/ncp_sourcedeploy_canary="canaryenv" in each pod label of the baseline and canary each, and you can use the value when analyzing the canary.
  • Create a metric to be evaluated, and select it.
    • Refer to Create metric for information about creating metrics.
    • If you want to adjust metric settings, select the metric whose settings you want to change, and then click the [Change settings] button. For more information on each item, refer to Create metric.
    • To delete a metric, select the metric to delete, and then click the [Delete] button.
    • The sum of the weights of all metrics should be 100.
  • Configure analysis settings.
    • Analysis delay time: Enter the time to start the analysis after the baseline or canary version application deployment.
      • The analysis begins after the time entered, and the range available is between 0 and 60 minutes.
    • Analysis time: Enter the total time during which an analysis will take place.
      • It can range between 10 and 360 minutes.
    • Analysis cycle: Enter the time cycle to perform the analysis.
      • The range available is between 1 and 360 minutes, and can't be greater than the analysis time.
    • Metric collection cycle: Enter the cycle to sample the collected metric values during analysis.
      • The range available is between 1 and 360 seconds.
  • Analysis success score: Enter the analysis score for all metrics during an analysis.
    • The available range is between 1 and 100.
    • Deployment is performed only when the score is satisfied for each analysis step.
    • If the score is not satisfied for an analysis step, then analysis stops immediately and the baseline and canary versions of the application will be ended.
    • This is the sum of all metric scores registered.
      • For more information about metric scores, refer to Create metric.

Create metric

[3. If you've selected your deployment strategy as Canary and analysis method as Automatic in 3. Set up deployment strategy, then the following describes how to create a metric.

  1. Click the [Create] button under Metric settings.
  2. Enter the metric information in the metric creation pop-up window.
    sourcedeploy-use-scenario_metric_ko
    • Enter a name of the metric.
    • Select Success criteria.
      • It's the success criteria for the query result of queries registered, and they are analyzed as Success or Failure.
      • There can be n query results, and Success/Failure is determined for each query result.
      • The score of the metric registered is calculated with the (successful query results/all query results) weight.
      • Baseline < Canary: successful if the value of the baseline version is greater than that of the canary version (successful if the value of deviation is negative or equal)
      • Baseline > Canary: successful if the value of the canary version is greater than that of the baseline version (successful if the value of deviation is positive or equal)
    • Select Query type.
      • Default: This is available when you use the label selector only.

        • Metric: Select the metric set for the Prometheus URL entered when configuring Canary automatic analysis settings.
        • Filter: Enter the desired label conditions.
          kubernetes_namespace="dev" , ncp_sourcedeploy_canary="${basecanary}"
          
        • Filter's ${basecanary} is provided as a reserved word to compare and analyze the baseline and canary. When you analyze a query with the reserved word, the query is made by substituting it with an analysis environment variable.
          Metric: requests_total
          Filter: ncp_sourcedeploy_canary=${basecanary}
          Canary: canaryenv, Baseline: baselineenv (Refer to Analysis environment variables in Canary automatic analysis settings)
          Baseline version query requests_total{ncp_sourcedeploy_canary="baselineenv"}
          Canary version query requests_total{ncp_sourcedeploy_canary="canaryenv"}
      • PromQL: You can use it by directly entering PromQL in the query.
        Example of web application requests' success rate for PromQL

        sum(requests_total{kubernetes_namespace="dev",custom_status="good", ncp_sourcedeploy_canary="${basecanary}"})/sum(requests_total{kubernetes_namespace="dev", ncp_sourcedeploy_canary="${basecanary}"})
        
    • Weight: Enter the metric's weight.
      • The available range is between 1 and 100.

4. Final confirmation

Check the information for the deployment scenario configured, and then click the [Create deployment scenario] button.

Build CI/CD environment

Using SourceDeploy, you can build a CI/CD environment for a continuous deployment in a Kubernetes Service cluster.

The following describes how to build a CI/CD environment.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Containers > Container Registry menus, in that order.
  3. Click the [Create registry] button to create a registry.
  4. Click the Services > Developer Tools > SourceBuild menus, in that order.
  5. Click the [Create build project] button to create a build project.
    • For more information about creating build projects, refer to SourceBuild Guide.
    • You can use the Docker image build feature to build the Docker image, and save the Docker image in Container Registry.
      • At the build settings step, click to select Build Docker image, and set Docker image build settings to Enabled in the build command configuration step.
      • Click to set Set as latest with the image tag.
        • As SourceDeploy automatically changes the latest tag to digest form and attempts to deploy it, continuous deployment can be performed normally, even if the image settings aren't changed.
        • You can use it together with image version control, you can always build the latest image.
  6. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  7. Click the [Create deployment project] button to create a new deployment project with Kubernetes Service as a development target.
  8. Create a deployment scenario by referring to Create Kubernetes Service deployment scenario.
  9. Click the Services > Developer Tools > SourcePipeline menus, in that order.
  10. Click the [Create pipeline button] to create a new pipeline.
    • For more information about the creating private pipelines, refer to the SourcePipeline Guide.
      • You can configure a pipeline with SourceBuild projects with the Docker image build set up and SourceDeploy projects with the Kubernetes Service deployment set up to build a CI/CD environment.
      • By clicking and selecting Set trigger, you can push to SourceCommit while deploying new objects to clusters of Docker image and Kubernetes Service to operate your service.
Note

The deployment image should be stored in the Container Registry to configure continuous deployment to Kubernetes Service cluster with SourceDeploy.

Create Object Storage deployment scenario

The following describes how to create a deployment scenario with Object Storage as a deployment target.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  3. Click a deployment project where you want to create the scenario, and then click a deployment stage with Object Storage as a deployment target.
  4. Click the [Create] button.
  5. When the deployment scenario creation page appears, proceed with the following steps in order.

1. Basic settings

Enter the deployment scenario's name and description, and then click the [Next] button.

2. Set up deployment file

Select the deployment file location and build project, and then click the [Next] button.
sourcedeploy-use-scenario_file2_ko

  • The available options for deployment file location are Source build, Object Storage, and Set later.
    • If you've selected Source build, then select a build project. If the last build result is a fail or the build output is not uploaded, then the deployment is not performed.
    • If you've selected Object Storage, then select a deployment file from the buckets in your Object Storage. Only the deployment file compressed as a .zip file can be deployed.
    • If you've selected Set later, then you can set up the deployment file when deploying the scenario.

3. Set up deployment path

Set the file's deployment path, and then click the [Next] button.
sourcedeploy-use-scenario_route_en

  • Enter source file path and deployment path, and then click the [Add] button.
    • You can enter and add multiple paths.
    • Source file path: Enter the file path to deploy.
    • Deployment path: Enter the path of the bucket to deploy.
  • In the case of locked buckets, the files already uploaded will be locked. It won't be correctly deployed if the same file name (deployment path) is entered.
  • If you've set the deployment file location to Set later in 2. Set up deployment files, or there's no last build output from SourceBuild, then Set later or No last build output is displayed in File deployment.
  • Click the [Delete] button to delete the added path.
  • To use the file backup function in the set distribution path, click Enable to select it.
    • When using the backup function, all files in the set distribution path are backed up.

4. Final confirmation

Check the information for the deployment scenario configured, and then click the [Create deployment scenario] button.

Change deployment scenario settings

The following describes how to change deployment scenario settings.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  3. Click the deployment project and deployment stage you want to change scenario settings for, in that order.
  4. Select the scenario to change the settings, and then click the [Change settings] button.
  5. Apply the changes in the deployment scenario settings pop-up window, and then click the [Apply] button.

Delete deployment scenario

The following describes how to delete a deployment scenario.

  1. Connect to the NAVER Cloud Platform console.
  2. Click the Services > Developer Tools > SourceDeploy menus, in that order.
  3. Click the deployment project and deployment stage you want to delete the scenario from.
  4. Select the scenario to delete, and then click the [Delete] button.
  5. Click the [Delete] button in the deployment scenario deletion pop-up window.
    • The deployment scenario will be deleted.

Was this article helpful?