This document describes how to select different types of workloads to run your services in an elastic cluster.
- Elastic clusters have no nodes. Workloads allocate resources for each pod based on parameter settings when they are created. For more information, see Specifying Resource Specifications.
- To create and manage Kubernetes objects by using a YAML file, specify annotations. For more information, see Annotation Description.
A Deployment declares the pod template and pod running policies. It is used to deploy stateless applications. You can specify the number of replicas, scheduling policy, and update policy for pods running in the Deployment as needed.
A StatefulSet is used to manage stateful applications. It creates a persistent identifier for each pod based on the specifications. The identifier will be retained after a pod is migrated, terminated, or restarted. When using persistent storage, you can map storage volumes to identifiers. If your application does not require any persistent identifier, we recommend that you use a Deployment to deploy the application.
A Job creates one or more pods and ensures that these pods run according to specified rules until they are terminated. Jobs can be used in many scenarios, such as batch computing and data analysis. You can specify the number of repeated running, concurrency, and restart policy as required.
A Job maintains existing pods and will not create new pods after it is completed. You can view the logs of completed pods in "Logs". Deleting a Job removes the pods it created and the logs of these pods.
A CronJob object is similar to a line in a crontab (cron table) file. It periodically runs a Job according to the specified schedule. For more information on the format, see Cron documentation.
The Cron format is as follows: