This topic describes how to run a job by using a virtual node. You can use this method during peak hours with no need for creating new nodes for your cluster.

Background information

When you use a virtual node, your Kubernetes cluster can provide greater computing capability and allow you to create pods as needed.

For example, you have a Kubernetes cluster with one managed Master node and two Worker nodes, and the specifications of each Worker node is 4 CPUs and 8 GB. Therefore, the specifications of the managed Kubernetes cluster is 8 CPUs and 16 GB.

To run an offline job with 16 CPUs and 32 GB to process data, you can schedule the job to a virtual node to save computing resources for nodes of the cluster.



  1. Connect to a Kubernetes cluster by using kubectl. For more information, see Connect to Kubernetes clusters through kubectl.
  2. Copy and paste the following codes to job.yaml and run the kubectl -n vk apply -f job.yaml command to deploy a job.
    kind: Job
      name: pi
          - name: pi
            image: perl
            command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
                cpu: 16
                memory: 32Gi
          restartPolicy: Never
      backoffLimit: 4
  3. Run the following command to view the pod running status.
    #kubectl -n vk get pod -a
    pi-7cmwv   0/1       Completed   0          2m
    #kubectl -n vk describe pod
    Name:               pi-7cmwv
    Namespace:          vk
    Priority:           0
    PriorityClassName:  <none>
    Node:               virtual-kubelet/
      Type    Reason                 Age   From               Message
      ----    ------                 ----  ----               -------
      Normal  Scheduled              3m    default-scheduler  Successfully assigned vk/pi-7cmwv to virtual-kubelet
      Normal  SuccessfulMountVolume  2m    kubelet, eci       MountVolume.SetUp succeeded for volume "default-token-b2tff"
      Normal  Pulling                2m    kubelet, eci       pulling image "perl"
      Normal  Pulled                 2m    kubelet, eci       Successfully pulled image "perl"
      Normal  Created                2m    kubelet, eci       Created container
      Normal  Started                2m    kubelet, eci       Started container
    Note The pod on a virtual node is charged according to the specific amount of resources that you use.