All Products
Search
Document Center

Alibaba Cloud DevOps:Use Kubernetes kubectl to release applications

Last Updated:Apr 29, 2025

Flow provides common Kubernetes deployment capabilities. You can use the built-in kubectl tool to deploy Kubernetes YAML files to any cluster. In addition to the capabilities provided by the native kubectl, Flow provides built-in dynamic templates to help you quickly build and release applications in Kubernetes. This topic describes how to use Flow to add and configure a Kubernetes release job and how to view the logs after the deployment.

Solution overview

  1. Add a deployment job.

  2. Configure a deployment job.

  3. View deployment logs.

Add a deployment job

You can add a deployment job by using one of the following methods.

  • When you create a pipeline, select a template that contains Kubernetes apply.

    高的 (41)

  • Add an empty job to the pipeline and add the Kubectl Apply step.

    image

Configure a deployment job

For the Kubectl Apply step, configure the following settings:

  1. Select or create a Kubernetes cluster connection. For more information about how to create a Kubernetes cluster connection, see Manage Kubernetes clusters.

    image

  2. Specify the Namespace parameter for the release.

  3. Specify the YAML PATH parameter for the current deployment, and add the required variables.

    1. In the Kubernetes YAML file, use the ${IMAGE} placeholder to define the Docker image as a dynamic variable.

      image

    2. In the Kubectl Apply step, add variables to the YAML file. When you configure the Kubectl Apply step, click Add on the right side of Variables and specify the variable name and source. After you configure variables, you can use these variables to dynamically replace placeholders in the YAML file.image

    Note

    For use cases of YAML files in Kubernetes, see References to Kubernetes YAML specifications.

View deployment logs

After the configuration is complete, run the pipeline to run the deployment job. The YAML file in the source code is deployed to the specified Kubernetes cluster.

  1. In the deployment process, click Logs.

    image

  2. View the log output and related records. The following figure shows an example. Logs contain all YAML files that are scanned, the standard output after the Kubectl Apply step is performed, and the overview information of all resources after the change.

    image

References to Kubernetes YAML specifications

Workloads

Resource type

References

Deployments

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

StatefulSets

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

DaemonSet

https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/

Service discovery and networks

Resource type

References

Service

https://kubernetes.io/docs/concepts/services-networking/service/

Ingress

https://kubernetes.io/docs/concepts/services-networking/ingress/