Skip to main content
Workloads represent deployed applications in Rancher. The Workload API provides a unified interface to manage Kubernetes workload resources including Deployments, StatefulSets, DaemonSets, CronJobs, and Jobs.

Workload Types

Rancher aggregates multiple Kubernetes workload types into a single Workload resource:

Deployment

Stateless applications with rolling updates

StatefulSet

Stateful applications requiring stable identities

DaemonSet

One pod per node (monitoring, logging agents)

CronJob

Scheduled batch jobs

Workload Resource

From pkg/api/norman/customization/workload/workload.go:48

Workload Spec

string
required
Name of the workload
string
required
Namespace where the workload is deployed
string
required
Type of workload: deployment, statefulSet, daemonSet, cronJob, job
array<Container>
required
List of containers in the workload
string
required
Container name
string
required
Container image (e.g., nginx:1.21)
array<ContainerPort>
Exposed container ports
array<EnvVar>
Environment variables
ResourceRequirements
Resource requests and limits
array<VolumeMount>
Volume mount points
integer
Number of replicas (for Deployment, StatefulSet, ReplicaSet)
array<Volume>
Volumes available to containers
map<string, string>
Labels for the workload
map<string, string>
Annotations for the workload
Scheduling
Pod scheduling configuration
NodeScheduling
Node selection criteria
array<Toleration>
Tolerations for node taints
boolean
Whether the deployment is paused (Deployment only)

Workload Status

string
Current state: active, updating, paused, stopped
integer
Desired number of replicas
integer
Number of ready replicas
integer
Number of available replicas
integer
Number of unavailable replicas
array<PublicEndpoint>
Exposed endpoints for the workload

Create Deployment

Deploy a stateless application:

Create StatefulSet

Deploy a stateful application with persistent storage:

Create DaemonSet

Deploy a pod on every node:

Create CronJob

Schedule a recurring batch job:

List Workloads

Retrieve all workloads in a project:

Filter by Namespace

Get Workload

Retrieve a specific workload:

Response Example

Update Workload

Update workload configuration:

Scale Workload

Update the scale:

Delete Workload

Delete a workload:

Workload Actions

From pkg/api/norman/customization/workload/workload.go:69

Pause Deployment

Pause a deployment to prevent updates:

Resume Deployment

Resume a paused deployment:

Redeploy

Force a redeployment of the workload:

Rollback

Rollback to a previous revision:

Get Revisions

List deployment revisions:

Resource Requirements

Define CPU and memory for containers:
Always set resource requests and limits to ensure proper scheduling and prevent resource exhaustion.

Environment Variables

Static Values

From ConfigMap

From Secret

Scheduling

Node Selection

Tolerations

Affinity Rules

Best Practices

Always define resource requests and limits:
  • Requests ensure proper scheduling
  • Limits prevent resource hogging
  • Required for QoS guarantees
Configure liveness and readiness probes:
  • Liveness: Restart unhealthy containers
  • Readiness: Control traffic routing
  • Startup: Handle slow-starting applications
Use meaningful labels for organization:
  • app: Application name
  • version: Application version
  • component: Application component
  • environment: Deployment environment
Never hardcode sensitive data:
  • Use Kubernetes Secrets
  • Reference secrets via environment variables
  • Rotate secrets regularly
For Deployments, configure update strategy:
  • maxSurge: Extra pods during update
  • maxUnavailable: Pods that can be down
  • Balance between speed and availability

Monitoring Workloads

Check Workload Status

View Pod Logs

Execute Commands

Next Steps

Services

Expose workloads with services

Ingress

Configure external access

Volumes

Attach persistent storage

Monitoring

Monitor application metrics