
AWS Batch is a managed batch computing service from Amazon Web Services (AWS). It runs containerized jobs from job definitions, orders the work you submit through job queues, and scales the compute environments behind those queues according to demand. That removes the need to operate a scheduler or manage the compute fleet, but it also ties job definitions, queue configuration, and permissions to AWS.
Volcano is a Cloud Native Computing Foundation (CNCF) incubating project that adds batch scheduling to Kubernetes, including gang scheduling, queue-based fair sharing, and job lifecycle management. The default Kubernetes scheduler places pods individually and cannot guarantee that all pods in a job start together, which makes it a poor fit for distributed training, simulation sweeps, and other batch work. Unlike AWS Batch, Volcano does not provision compute. It schedules work onto a cluster you already operate, and you typically pair it with an autoscaler such as Karpenter or Cluster Autoscaler. That difference shapes both the migration and the cost model.
This article explains how to deploy Volcano as an alternative to AWS Batch. It covers the Volcano installation with Helm, weighted queues with capability limits, gang-scheduled and multi-task jobs, retry and failure policies, monitoring with Prometheus and Grafana, and migration from AWS Batch.
Volcano installs three components into the cluster. The scheduler places any pod that names it, the controller manager turns Volcano's custom resources into pods, and an admission webhook validates those resources when you create them. Three of its custom resource definitions (CRDs) carry most of the work: Queue holds the sharing policy, Job describes the work, and PodGroup represents a set of pods that the scheduler places as a unit.
The following table maps AWS Batch features to their closest Volcano equivalents. Some features match directly, but others differ in scope or behavior, so read the description column before you migrate.
Before you begin:
Volcano publishes a Helm chart that installs the scheduler, the controller manager, and the admission webhook in a single namespace and registers the Volcano CRDs.
Add the Volcano chart repository.
Refresh the repository index.
Install the chart into a new namespace.
Check the official Volcano Helm chart page for the latest release.
Verify that the scheduler, controller, and webhook pods are running.
The output displays all pods, each with a Running status.
Verify that the CRDs are registered.
The output lists all registered Volcano CRDs.
A queue is the unit of sharing in Volcano. Each queue carries a weight that determines its proportional share of the cluster under contention, and an optional capability that caps its consumption, regardless of how much capacity the cluster has free.
List the queues that Volcano creates at install time.
The output lists two queues, root and default, and shows root as the parent of default.
Create a queue file named analytics-queue.yaml.
Add the following configuration.
Save and close the file.
Apply the analytics queue.
Create a queue file named reporting-queue.yaml.
Add the following configuration.
Save and close the file.
Apply the reporting queue.
Verify the weights and ceilings.
The output shows a weight and CPU ceiling for analytics and reporting queues.
Gang scheduling is the main reason teams adopt Volcano. A VolcanoJob declares minAvailable, and the scheduler places that many pods at once or places none at all. By default, the Kubernetes scheduler can start five pods of a job that needs eight, leaving them waiting for three that never arrive, thereby holding resources without making progress.
Create a job file named gang-demo.yaml.
Add the following configuration.
Save and close the file.
Submit the job.
Check the pod group that Volcano creates for the job.
The PodGroup reports a Running status with 3 in the RUNNINGS column once the scheduler places all three pods, which takes only a few seconds.
Verify that all three pods start together.
The output lists three gang-demo-worker pods, each with a Running status and the same age.
Check the job status.
The job reports Running while the containers sleep, and Completed about 30 seconds after the pods start.
Read the output from one of the pods.
The log shows worker starting, followed by worker done once the 30-second sleep ends.
Remove the job.
An AWS Batch array job runs the same container multiple times, distinguishing each copy by an index. Volcano expresses that as a task with several replicas, and it also lets one VolcanoJob define several distinct tasks, each with its own image and replica count. That covers the topologies that AWS Batch handles through multi-node parallel jobs.
Create a job file named multitask-demo.yaml.
Add the following configuration.
Save and close the file.
The two tasks use different images and replica counts within one job. minAvailable counts pods across every task, so a value of 3 covers the master and both workers.
Submit the job.
Verify that all three pods are running.
The master pod and both worker pods report a Running status.
Read the master's view of the job.
The output shows INDEX=0, WORKER_NUM=2, and a WORKER_HOSTS value that lists the hostnames of both worker pods.
Read a worker's view of the job.
The output shows INDEX=0 and a MASTER_HOSTS value that contains the master pod's hostname.
Remove the job.
AWS Batch retries a job based on an attempt count and optional exit conditions. Volcano splits that behavior into two: maxRetry on the job caps how many times a job can restart, and policies on each task decide which pod events trigger a restart.
Create a job file named retry-demo.yaml.
Add the following configuration.
Save and close the file.
The container exits with status 1 on every run, so the job uses all of its retries and then fails. RestartJob restarts every task in the job, while RestartTask restarts only the affected task.
Submit the job.
Wait about 30 seconds for the retries to run out, then check the job status.
The job reports a Failed status. Run the command again if it still shows Running or Restarting.
Read the retry count and the events that produced it.
The Status section reports Retry Count: 3, and the Events section shows the Start to execute action RestartJob event with an x3 count, one for each retry.
Remove the job.
The Volcano scheduler and controller both serve Prometheus metrics, and the chart enables those endpoints by default.
Verify that the metrics services exist.
The volcano-scheduler-service exposes port 8080, and the volcano-controllers-service exposes port 8081. Both serve Prometheus metrics.
Add the Prometheus community repository.
Refresh the repository index.
Install the monitoring stack.
Check the official kube-prometheus-stack Helm chart page for the latest release.
Verify that the monitoring pods are running.
Every pod reports a Running status within a few minutes. Run the command again if any pod is still starting.
Verify that the stack requested no persistent volumes.
The command reports that no resources were found in the monitoring namespace because Prometheus, Alertmanager, and Grafana use ephemeral storage by default.
Create a service monitor file.
Add the following configuration.
Save and close the file.
Apply the service monitor.
Create a job file named metrics-load.yaml.
Add the following configuration.
Save and close the file.
Submit the job.
Forward the Prometheus service to your workstation.
List the active Volcano scrape targets.
The output lists one target for the scheduler and one for the controller. Prometheus can take up to 2 minutes to load new ServiceMonitors, so rerun the command if the output is empty or a target is missing.
Query the allocated CPU for each queue.
The JSON response reports a value of 2000 for the analytics queue, which matches four replicas at 500m each, and 0 for the other queues. If every queue reports 0, wait a minute, then run the command again.
Stop the port forward.
Retrieve the Grafana administrator password.
The command prints the password for the admin user. Save the password for use in the following steps.
Forward the Grafana service to your workstation.
Open http://localhost:3000 in a web browser and sign in as admin with the password from the earlier step.
Select Explore in the left-hand menu.
Choose the Prometheus data source and select volcano_queue_allocated_milli_cpu from the Metric drop-down.
Click the Run query icon in the top-right corner.
The graph shows the allocated CPU of each queue, with the analytics queue at 2000 millicores while the metrics-load job runs.
Stop the port forward.
Remove the load metrics job.
Confirming that Volcano runs is different from confirming that it schedules differently from the default scheduler. The checks below cover both, and end with a job that cannot fit, which is where gang scheduling becomes visible.
List the queues and their hierarchy.
The output lists the analytics, default, and reporting queues, each with root as its parent.
Create a job file named verify-demo.yaml.
Add the following configuration.
Save and close the file.
Submit the job.
List the jobs.
The job reports Pending until the scheduler places both pods, then as Running with two replicas running. After a minute, the containers exit and the job reports Completed.
Remove the job.
Record the cluster's CPU capacity.
Each node reports its allocatable CPU in cores or millicores. Add the values together and note the total as A, in cores. For example, a value of 7910m is 7.91 cores.
Raise the queue ceiling so that the cluster limits the next job.
Create a job file named filler.yaml.
Add the following configuration. Replace FILLER_REPLICAS with half of A, rounded down. For example, on a 24 vCPU cluster, use 12.
Save and close the file.
This job sets minAvailable: 1, so its pods start individually as capacity allows.
Submit the filler job.
Count the running filler pods.
The command reports the value you set for FILLER_REPLICAS. Run it again if the count is lower, because the pods can take a few seconds to start.
Record how much CPU is already requested on the cluster.
Add the CPU requests from each node and note the total as R, in cores. R includes the filler pods and the system pods.
Create a job file named gang-wait.yaml.
Add the following configuration. Replace GANG_REPLICAS with a whole number that satisfies the rule after the code block. Each pod requests 1 CPU, so the job's total CPU request equals that number.
Save and close the file.
Choose GANG_REPLICAS so that the following holds:
A − R, so the job cannot start and waits.1.2 × A − R. Volcano checks a job's minimum resources against that limit before it creates pods. A job that fails the check gets no pods, so the pod count in a later step finds nothing. For example, on a 24 vCPU cluster (A = 24) where system pods request 2 cores and the filler job requests 12, R is 14. The free CPU is 24 − 14 = 10, and the upper limit is 1.2 × 24 − 14 = 14.8. Any whole number from 11 to 14 works, so use 12.
Submit the job.
Count the pods by status.
The command reports GANG_REPLICAS pods in the Pending state.
Remove the filler job to free capacity.
Check the gang job status.
The job reports Running with GANG_REPLICAS running replicas once the cluster has room for the whole group, which can take up to a minute.
Restore the queue ceiling.
Remove the job.
This section outlines the strategy for migrating batch workloads from AWS Batch to Volcano. It focuses on how AWS Batch concepts map onto Volcano resources, so the approach stays applicable as both projects release new versions. Refer to the current AWS Batch and Volcano documentation for the exact settings your workloads require as you plan your migration.
Job definition migration rewrites each AWS Batch job definition as a task inside a VolcanoJob. The image, command, and environment variables from the job definition's container properties are moved into the task's pod template, and the VCPU and MEMORY entries in resourceRequirements become resources.requests for the container. AWS Batch expresses memory in MiB, so a value of 2048 becomes 2048Mi.
An array job becomes a single task with replicas set to the array size and the env plugin enabled, and VC_TASK_INDEX replaces AWS_BATCH_JOB_ARRAY_INDEX, so change the application to read VC_TASK_INDEX. A multi-node parallel job becomes one task for each node range in nodeRangeProperties, with minAvailable set to the total node count and the svc plugin enabled. VC_<TASK_NAME>_HOSTS replaces AWS_BATCH_JOB_MAIN_NODE_PRIVATE_IPV4_ADDRESS, such as VC_MASTER_HOSTS for a task named master, so change the child nodes to read the main node's hostname from it. The Volcano variable holds a DNS name.
Queue migration starts with one Volcano queue for each AWS Batch job queue, but the two systems order work differently. AWS Batch evaluates job queues that share a compute environment in order of priority. Volcano queues have their own priority field. Higher values are prioritized for scheduling. When the reclaim action is enabled, the scheduler considers those queues later during capacity reclamation, so map the AWS Batch queue priority to that field.
Volcano also divides capacity between queues by weight, which is a soft limit. A queue can borrow idle capacity and returns it only when another queue reclaims it. Set the weight for each queue's share, and confirm the resulting shares under load. The weight field requires the proportion plugin, which the default scheduler configuration enables.
To keep the original compute limit, set capability on each queue. It acts as a hard upper limit. If several queues share a compute environment, give each queue the full maxvCpus value to share the pool, or divide the value among the queues to isolate them.
AWS Batch fair-share policies divide a single job queue between share identifiers by weightFactor, where a lower value earns more compute. Volcano's weight works the other way, so invert the values when you convert them. Within a Volcano queue, the default drf plugin favors the job with the smallest share of cluster resources and does not use per-workload weights, so place workloads that need different shares in separate weighted queues.
AWS Batch adjusts the instance count of a managed compute environment between its minimum and maximum vCPUs based on job queue demand. Volcano does not provision compute. It places pods on the nodes the cluster already has, so a job that does not fit waits until capacity becomes available.
Run a cluster autoscaler, such as Karpenter or the Cluster Autoscaler, for bursty workloads, and allow time for it to add a node. If you do not run an autoscaler, size node pools for peak job concurrency. Volcano's enqueue action holds a job's PodGroup in Pending until the job's minimum demand fits within the cluster's total resources multiplied by the overcommit-factor (default 1.2), minus the resources already in use. A job slightly larger than the free capacity still enqueues, and its Pending pods can trigger an autoscaler. A job far larger than the cluster creates no pods, so a pending-pod autoscaler never sees it. Test this behavior before you rely on it.
The following items require attention during the migration:
reclaim action, so a queue keeps borrowed capacity until its jobs finish. To change this, add reclaim to the actions list in the volcano-scheduler-configmap ConfigMap.AWS_BATCH_JOB_ARRAY_INDEX is unique across the entire array, whereas VC_TASK_INDEX restarts at 0 for each task. A job with several tasks needs its own scheme for globally unique identifiers.minAvailable and task replica counts, so most changes require you to delete and recreate the job. Manage revisions with Helm or Kustomize.attempts, counting the first run, and can retry or exit based on exit codes and status reasons. Volcano's maxRetry limits how many times a job can restart. The Volcano docs describe it as both retries and tries, so test whether the first run counts before you convert attempts values. Volcano restarts a job only when a lifecycle policy matches a pod event, such as PodEvicted with the RestartJob action. A Volcano restart also replaces the previous attempt's pods, so ship logs to external storage if you need them from earlier attempts.Pending, Running, Restarting, Completed, and Failed, along with Kubernetes events and Prometheus metrics. You build alerts and dashboards yourself.You have successfully deployed Volcano on a Kubernetes cluster as an alternative to AWS Batch. You configured weighted queues, ran gang-scheduled, multi-task, and retrying jobs, and monitored queue allocation with Prometheus and Grafana. For more information, visit the official Volcano documentation.
0 Comments
Be the first to comment and share your perspective with the community.