Workload management

Last updated: 2020-02-19 19:34:35


Operation scene

This article describes how to choose a variety of workload forms to run your service in an elastic cluster.

If you need to create and manage your elastic container workload through YAML, be sure to read Elastic TKE Annotation description .


  • An elastic cluster with a status of "running" has been created. For more information, see This API creates a Cluster .
  • The cluster has an appropriate namespace that is in the state of Active.

Introduction to workload types


A Deployment describes the template of a Pod and the policy that controls how the Pod runs, which is well suited for deploying stateless applications.. You can specify the number of Pod copies running in the Deployment, the policy of scheduling and update the policy as needed.


A StatefulSet is primarily used to manage stateful applications, and a created Pod has a persistent identifier for creation according to the specification. The identifier will remain after the Pod is migrated, terminated, or restarted. When you need persistent storage, you can match the storage volumes one to one based on the identifier. If your application does not require a persistent identifier, you are recommended to use a Deployment to deploy the application.


The Job controller creates 1-N Pod, which run according to the operating rules until the end of the run. Job can be used in scenarios such as BatchCompute and data analysis to meet business requirements by setting repeated execution times, parallelism, restart policy and other settings.
After the Job execution is complete, the new Pod, will not be created or the existing Pod, will not be deleted. You can view the log of the completed Pod in the Log. Deleting a Job will clean up the Pods it created as well as the logs of those 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 about the format, see cron's documentation.
The cron format is as follows:

# File Format Description
#  ——Minute(0 - 59)
# |  ——Hour(0 - 23)
# | |  ——Day(1 - 31)
# | | |  ——Month(1 - 12)
# | | | |  ——Week(0 - 6)
# | | | | |
# * * * * *

Operation step

  1. Log in to the TKE console and select [in Left sidebar] Elastic cluster ].
  2. On the "Elastic clusters" list page, click the cluster ID, for which you want to create the workload to enter the cluster "Deployment" page. as shown below:
  1. Click [Create] to go to the "Create Workload" page.
  2. Enter workload name and select the type of workload you want to create.

Elastic TKE Annotation description

Annotation KeyAnnotation ValueDescriptionRequired/Optional seeResource specificationEnter, the default unit is nuclear, which does not need to be indicated.CPU parameters of Pod specificationYes, the specification that does not fill in or Enter does not exist will report an error. seeResource specificationEnter, you need to indicate the unit, such as 512Mi, 0.5Gi, 1GiMemory parameters of Pod specificationYes, the specification that does not fill in or Enter does not exist will report an error. group ID, but Enter has more than one, in order to,Split, for exampleSg-id1,sg-id2Security group bound by default for workloadNo, if not, Enter will default to Associate's workload bound to Intra-region 's default security group.
If Enter, please make sure that Enter Intra-region exists in the security group ID, otherwise an error will be reported.

Complete exampl

apiVersion: apps/v1beta2
kind: Deployment
  annotations: "1"
    description: test "1" 2Gi "sg-dxxxxxx5,sg-zxxxxxxu"
  creationTimestamp: "2019-10-11T03:47:55Z"
  generation: 1
    k8s-app: nginx
    qcloud-app: nginx
  name: nginx
  namespace: default
  resourceVersion: "33796648"
  selfLink: /apis/apps/v1beta2/namespaces/default/deployments/nginx
  uid: e86f6533-ebd9-11e9-b061-4effc6de97a3
  minReadySeconds: 10
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
      k8s-app: nginx
      qcloud-app: nginx
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
      annotations: "1" 2Gi "true"
      creationTimestamp: null
        k8s-app: nginx
        qcloud-app: nginx
      - env:
        - name: PATH
          value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        - name: NGINX_VERSION
          value: 1.17.4
        - name: NJS_VERSION
          value: 0.3.5
        - name: PKG_RELEASE
          value: 1~buster
        imagePullPolicy: Always
        name: nginxcontainer
            cpu: 500m
            memory: 1Gi
            cpu: 250m
            memory: 256Mi
          privileged: false
          procMount: Default
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        - mountPath: /tmp
          name: vol
      dnsPolicy: ClusterFirst
      - name: qcloudregistrykey
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      - emptyDir: {}
        name: vol