Configuration Overview
Metaflow’s Kubernetes integration is configured through environment variables and decorator parameters. This page provides a comprehensive reference for all available configuration options.Environment Variables
Basic Configuration
Kubernetes namespace for running Metaflow jobs.
Kubernetes ServiceAccount to use for pod execution. This account needs appropriate RBAC permissions.
Container Configuration
Default Docker image for Metaflow tasks. If not specified, a vanilla Python image matching your local Python version is used.
Container registry URL prepended to image names that don’t include a registry.
Image pull policy for containers. Options:
Always, IfNotPresent, Never.JSON list of image pull secret names for accessing private registries.
Resource Defaults
Default CPU request for Kubernetes pods (in cores).
Default memory request for Kubernetes pods (in MB).
Default ephemeral disk request for Kubernetes pods (in MB).
Default GPU vendor. Options:
nvidia, amd.Storage Configuration
S3 bucket URL for storing Metaflow artifacts and code packages.
Azure Blob Storage URL for storing Metaflow artifacts.
Google Cloud Storage bucket URL for storing Metaflow artifacts.
Scheduling and Node Selection
Comma-separated list of node selector key-value pairs.
JSON list of tolerations for scheduling pods on tainted nodes.
Default Quality of Service class for pods. Options:
Guaranteed, Burstable.Storage and Volumes
JSON object mapping PVC names to mount paths.
Shared memory size in MB for /dev/shm.
Security
Comma-separated list of Kubernetes secret names to mount as environment variables.
Labels and Annotations
Comma-separated list of labels in key=value format.
Comma-separated list of annotations in key=value format.
Advanced Options
Port number to expose from containers (used with @parallel for multi-node communication).
Fetch EC2 instance metadata when running on AWS EKS.
Shell script to execute before task initialization (for custom environment setup).
Argo Workflows Configuration
URL for the Argo Workflows UI.
Comma-separated list of secrets to mount in Argo Workflows.
Webhook URL for Argo Events integration.
Name of the Argo Events EventBus.
Namespace for Argo Events Sensors.
Decorator Parameters
The@kubernetes decorator accepts the following parameters to override defaults:
Resource Specification
Container Configuration
Scheduling and Placement
Storage and Volumes
Security
Metadata
Advanced Options
Complete Configuration Example
Here’s a complete example showing environment variables and decorator usage:Environment Setup
Flow Implementation
Quality of Service (QoS) Classes
Kubernetes assigns QoS classes based on resource requests and limits:Guaranteed QoS
- CPU and memory limits are set equal to requests
- Highest priority for scheduling
- Last to be evicted under resource pressure
- Best for critical, resource-intensive workloads
Burstable QoS (Default)
- CPU and memory requests set, but can burst above
- Medium priority for scheduling
- Can be throttled or evicted if resources are needed
- Good for most workloads with variable resource usage
Multi-Node Configuration
For distributed workloads using@parallel:
Security Context Configuration
Configure container security context:Troubleshooting Configuration Issues
Image Pull Errors
Image Pull Errors
Symptoms: Pods stuck in
ImagePullBackOff or ErrImagePullSolutions:-
Verify image name and registry:
-
Check image pull secrets:
-
Test image pull manually:
Resource Quota Exceeded
Resource Quota Exceeded
Symptoms: Pods stuck in
Pending with reason Quota ExceededSolutions:-
Check namespace quotas:
-
View current resource usage:
- Request quota increase or reduce resource requests
Scheduling Failures
Scheduling Failures
Symptoms: Pods stuck in
Pending with reason UnschedulableSolutions:-
Check node selector and tolerations:
-
Verify node availability:
-
Check taints:
PVC Mount Failures
PVC Mount Failures
Symptoms: Pods stuck in
ContainerCreating with volume mount errorsSolutions:-
Verify PVC exists and is bound:
-
Check storage class:
-
Ensure PVC access mode is compatible:
Configuration Best Practices
Environment Separation
Use different namespaces and configurations for dev, staging, and production:
Resource Defaults
Set conservative defaults in environment variables and override in decorators as needed for specific steps.
Security First
Always configure security context, use secrets for sensitive data, and follow the principle of least privilege.
Labels and Annotations
Use consistent labeling for cost tracking, monitoring, and organization:
Next Steps
Kubernetes Overview
Learn about Kubernetes execution concepts
Argo Workflows
Deploy production workflows with Argo
Resource Management
Optimize resource allocation
Secrets Management
Secure sensitive data
