Skip to main content

Overview

The Workload custom resource defines application workloads deployed on Datum Cloud infrastructure. Workloads represent containerized applications with their compute, networking, and storage requirements.
Workload resources are part of the Milo compute API group (compute.miloapis.com/v1alpha1).

Resource Definition

apiVersion: compute.miloapis.com/v1alpha1
kind: Workload
metadata:
  name: my-workload
  namespace: project-<project-name>
spec:
  # Workload specification fields

API Group

apiVersion
string
required
compute.miloapis.com/v1alpha1
kind
string
required
Workload

Metadata

metadata.name
string
required
The name of the workload. Must be unique within the namespace.
metadata.namespace
string
required
The project namespace where this workload is deployed. Format: project-<project-name>
metadata.labels
object
Optional labels to organize and select workloads.Common labels:
  • app.kubernetes.io/name: Application name
  • app.kubernetes.io/version: Application version
  • app.kubernetes.io/component: Component type (backend, frontend, etc.)
  • environment: Environment (dev, staging, prod)
metadata.annotations
object
Optional annotations for additional metadata.Standard annotations:
  • kubernetes.io/description: Human-readable description
  • kubernetes.io/display-name: Display name for UIs

Spec Fields

The Workload spec defines the desired workload configuration:
spec.replicas
integer
default:"1"
The desired number of replicas for this workload.
spec.selector
object
Label selector for identifying pods managed by this workload.
spec.template
object
required
Pod template defining the workload containers.
spec.networkRef
object
Reference to the network this workload should use.
spec.provider
object
Provider-specific configuration for workload placement.

Status Fields

The Workload status reflects the current state:
status.phase
string
The current phase of the workload.Values:
  • Pending: Workload deployment is pending
  • Provisioning: Resources are being created
  • Running: Workload is running
  • Failed: Workload deployment failed
  • Deleting: Workload is being deleted
status.replicas
integer
Total number of replicas.
status.readyReplicas
integer
Number of ready replicas.
status.availableReplicas
integer
Number of available replicas.
status.conditions
array
Detailed conditions about the workload state.Each condition includes:
  • type: Condition type (e.g., “Available”, “Progressing”)
  • status: True, False, or Unknown
  • reason: Machine-readable reason code
  • message: Human-readable message
  • lastTransitionTime: When the condition last changed

Examples

Basic Web Application

apiVersion: compute.miloapis.com/v1alpha1
kind: Workload
metadata:
  name: web-app
  namespace: project-myproject
  labels:
    app.kubernetes.io/name: web-app
    environment: production
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web-app
  template:
    metadata:
      labels:
        app: web-app
    spec:
      containers:
      - name: nginx
        image: nginx:1.25
        ports:
        - containerPort: 80
          name: http
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 500m
            memory: 512Mi

Workload with Network Reference

apiVersion: compute.miloapis.com/v1alpha1
kind: Workload
metadata:
  name: api-server
  namespace: project-myproject
spec:
  replicas: 2
  networkRef:
    name: prod-network
  template:
    spec:
      containers:
      - name: api
        image: myregistry/api:v1.0
        ports:
        - containerPort: 8080
        env:
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: db-credentials
              key: url
        resources:
          requests:
            cpu: 200m
            memory: 256Mi
          limits:
            cpu: 1000m
            memory: 1Gi

Multi-Container Workload

apiVersion: compute.miloapis.com/v1alpha1
kind: Workload
metadata:
  name: app-with-sidecar
  namespace: project-myproject
spec:
  replicas: 1
  template:
    spec:
      containers:
      - name: app
        image: myapp:latest
        ports:
        - containerPort: 3000
      - name: log-collector
        image: fluent/fluent-bit:latest
        volumeMounts:
        - name: logs
          mountPath: /var/log
      volumes:
      - name: logs
        emptyDir: {}

kubectl Commands

Create a Workload

kubectl apply -f workload.yaml

List Workloads

# List all workloads in a project
kubectl get workloads -n project-myproject

# List with custom columns
kubectl get workloads -n project-myproject \
  -o custom-columns=NAME:.metadata.name,REPLICAS:.status.replicas,READY:.status.readyReplicas,PHASE:.status.phase

Get Workload Details

# Get full specification
kubectl get workload web-app -n project-myproject -o yaml

# Get status only
kubectl get workload web-app -n project-myproject -o jsonpath='{.status}'

# Describe with events
kubectl describe workload web-app -n project-myproject

Scale a Workload

# Scale to 5 replicas
kubectl scale workload web-app -n project-myproject --replicas=5

# Patch replicas
kubectl patch workload web-app -n project-myproject \
  -p '{"spec":{"replicas":5}}'

Update Workload Image

kubectl set image workload/web-app -n project-myproject \
  nginx=nginx:1.26

Delete a Workload

kubectl delete workload web-app -n project-myproject

Watch Workload Status

kubectl get workload web-app -n project-myproject --watch
  • Network - Connect workloads to networks
  • Gateway - Expose workloads externally
  • Project - Workloads are scoped to projects

Troubleshooting

Check:
  1. View workload status: kubectl describe workload <name> -n <namespace>
  2. Check for error conditions in status.conditions
  3. Verify container images are accessible
  4. Check resource quotas: kubectl get resourcequota -n <namespace>
Check:
  1. View pod status: kubectl get pods -n <namespace> -l app=<selector>
  2. Check pod logs: kubectl logs -n <namespace> <pod-name>
  3. Verify network connectivity
  4. Check resource limits and node capacity
Check:
  1. Verify you have update permissions on the workload
  2. Check if quota limits are exceeded
  3. Ensure the workload is in a valid state (not deleting)

Build docs developers (and LLMs) love