Workload management

Last updated: 2020-04-27 11:41:30


    This document describes how to select different types of workloads to run your services in an elastic cluster.

    To create and manage your Elastic Kubernetes Service (EKS) workloads by using a YAML file, see EKS Annotation Description.


    • An elastic cluster has been created and is in the Running state. For more information, see Creating a Cluster.
    • The cluster has an appropriate namespace that is in the Active state.

    Workload Types


    A Deployment declares a template for a pod and a policy for controlling how the pod runs. It is used to deploy stateless applications. You can specify the number of replicas, a scheduling policy, and an update policy for a pod that runs in the Deployment as required.


    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 the 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 the specified rules until a specified number of them successfully terminate. Jobs can be used in many scenarios, such as batch computing and data analysis. You can specify the required number of completions, concurrency (the number of pods running at any instant), and the restart policy as required.
    When a Job is completed, no more pods are created, but the existing pods are retained. You can view the logs of the completed pods in Logs. Deleting a Job removes the pods it created, and the logs of these pods will be invisible.


    A CronJob object is like one line of a crontab (cron table) file. It runs a Job periodically on a given schedule and uses the Cron format.
    The Cron format is as follows:

    # File format description
    #  ——min (0 - 59)
    # |  ——hour (0 - 23)
    # | |  ——day of month (1 - 31)
    # | | |  ——month (1 - 12)
    # | | | |  ——day of week (0 - 6)
    # | | | | |
    # * * * * *


    1. Log in to the TKE console and click Elastic Cluster in the left sidebar.
    2. On the Elastic Cluster page that appears, click the ID of the cluster where the workload that you want to create is located. The Deployment page for the cluster appears.
    3. Click Create to go to the New Workload page.
    4. Specify a name and type of the workload to be created.

    EKS Annotation Description

    Annotation Key Annotation Value Description Required Specify the value as instructed in Resource Specifications. The default unit is core. CPU specifications for the pod Yes. An error occurs if the value is not specified or the specified specification does not exist. Specify the value according to Resource Specifications. The unit should be included in the value, for example, 512Mi, 0.5Gi, or 1Gi. CPU specifications for the pod Yes. An error occurs if the value is not specified or the specified specification does not exist. The ID of the security group bound to the workload. You can specify multiple values and separate them with commas (,), for example, sg-id1,sg-id2Security group bound to the workload by default No. If no value is specified, the system binds the workload to the default security group for the region where the workload is located.
    You must set the value to a security group ID that exists in the region where the workload is located.

    Sample code

    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
          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

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback