Updated on 2025-06-13 GMT+08:00

Workloads

In Kubernetes, a workload abstracts a group of pods and the details about how they are running. It defines the deployment specifications, lifecycle management policies, and expected status of applications. The workload controller continuously observes and dynamically adjusts the number of pods for the workload to ensure that the pods are always in the states that you have defined. In addition, workloads provide O&M capabilities such as version management, rolling updates, and auto scaling. These functions make it easier for developers to manage various service scenarios, such as stateless services, stateful applications, long-term services, and batch computing tasks, in a declarative manner.

CCE provides native Kubernetes capabilities for you to deploy and manage workloads throughout their lifecycle. It supports workload creation, configuration, monitoring, auto scaling, upgrade, deletion, service discovery, and load balancing.

Creating a Workload

CCE clusters support different types of workloads for different service scenarios.

  • Deployments manage applications that do not rely on local storage or persistent state. Each Deployment pod is independent and can be replaced or scaled at any time. Deployments are suitable for web services and APIs that do not require persistent data. They support fast scaling and rolling updates.
  • StatefulSets manage applications that require persistent storage and states. Each StatefulSet pod has a unique identifier and persistent data. StatefulSets are suitable for applications that require persistent storage and stable network identifiers, such as databases and distributed storage systems.
  • DaemonSets ensure that a DaemonSet pod runs on each node (or only on nodes with matched labels) in a cluster. They are usually used for cluster-wide services such as log collection and performance monitoring.
  • Jobs are used to execute one-off or short-term batch processing tasks. After the tasks are complete, the pods are automatically terminated. Jobs support retries to ensure reliable task execution. You can also use a job to run multiple pods in parallel. Jobs are typically used for scenarios like data processing and report generation.
  • CronJobs run jobs periodically on a given schedule and automatically trigger job execution based on the specified cron expression. CronJobs feature precise scheduling and job history management. They are typically used for batch processing scenarios such as daily backups and periodic report generation.

Managing a Workload

CCE provides comprehensive O&M management capabilities for workloads you create in CCE clusters.

Table 1 Workload management

Operation

Description

View Log

You can view the logs of workloads.

Upgrade

You can replace images or image tags to quickly upgrade Deployments and StatefulSets without interrupting services.

Edit YAML

You can modify and download the YAML files of Deployments, StatefulSets, CronJobs, and pods on the CCE console. YAML files of jobs can only be viewed, copied, and downloaded.

NOTE:

If an existing CronJob is modified, the new configuration will apply to the new pods, and existing pods continue to run without any change.

Roll Back

You can roll back a Deployment. Only Deployments support this operation.

Redeploy

You can redeploy a workload. After the workload is redeployed, all pods in the workload will be restarted.

Enable/Disable Upgrade

You can enable or disable upgrade for a Deployment. Only Deployments support this operation.

Manage Label

Labels are key-value pairs that can be attached to workloads. You can manage and select workloads based on their labels. Jobs and CronJobs do not support this operation.

Delete

You can delete workloads that are no longer needed. Deleted workloads cannot be recovered.

View Events

You can view event names, event types, number of occurrences, Kubernetes events, first occurrence time, and last occurrence time of workloads.

Stop/Start

You can stop or start a CronJob. Only CronJobs support this operation.

For details, see Managing Workloads.

Managing Workload Lifecycle

Workloads have the statuses shown in the table below. You can learn about the services by viewing the workload status.

Table 2 Status description

Status

Description

Running

All pods are running or the number of pods is 0.

Unready

The container malfunctions and the pod under the workload is not working.

Processing

The workload is not running but no error is reported.

Available

For a multi-pod Deployment, some pods are abnormal but at least one pod is available.

Completed

The task is successfully executed. This status is available only for common tasks.

Stopped

The workload is stopped and the number of pods changes to 0. This status is available for workloads earlier than v1.13.

Deleting

The workload is being deleted.