Deployments

Updated at:

A deployment is a workload, such as nginx, that does not save data or state while running. You can create a deployment using a YAML file. After a deployment is created, you can monitor or delete it.

Note

Deployments are a native Kubernetes concept. For more information, see the official Kubernetes documentation.

Create a deployment

This section describes how to create a deployment from a YAML file.

Procedure

  1. Log on to the SOFASTACK console.

  2. In the navigation pane on the left, click Container Application Service > Workloads > Deployments.

  3. On the Deployments page, click Create from YAML.

  4. Enter the YAML content in the input box and click Submit.

    The following is an example:

    kind: Deployment
    metadata:
      name: deployment-example
      labels:
      k8s-app: deployment-example
      namespace: yournamespace  # Change this to the name of your current namespace.
    spec:
      replicas: 1
      selector:
      matchLabels:
        k8s-app: deployment-example
      template:
      metadata:
        labels:
        k8s-app: deployment-example
      spec:
        containers:
        - name: nginx
        image: reg-cnsh.cloud.alipay.com/library/nginx:latest # Change this to the registry address for your current region.

After the deployment is created, it enters the Deploying state. When the deployment is successful, its state changes to Running.

Update a deployment

This section describes how to update a deployment by modifying its YAML file.

Prerequisites

The YAML configuration has been created.

Procedure

  1. Log on to the SOFASTACK console.

  2. In the navigation pane on the left, click Container Application Service > Workloads > Deployments.

  3. On the Deployments page, click View/Edit YAML in the Actions column.

  4. In the YAML editor, modify the content and click Update.

    After a successful update, the system automatically redeploys the deployment based on the new YAML file.

Delete a deployment

This section describes how to delete a deployment.

Prerequisites

The YAML file is created.

Procedure

  1. Log on to the SOFASTACK console.

  2. In the left navigation pane, click Container Application Service > Workloads > Deployments.

  3. On the Deployments page, click Delete in the Actions column. In the dialog box, click OK.

Monitor a deployment

This section describes how to monitor a deployment.

Prerequisites

The YAML file is created.

Procedure

  1. Log on to the Container Application Service console. In the navigation pane on the left, click Workloads > Deployments.

  2. On the Deployments page, click Monitoring in the Actions column. You are redirected to the CloudMonitor console. You can use this console to view the monitoring metrics for the deployment.

Note

For more information about operations in the CloudMonitor console, see View application groups.