| name | containerization |
| description | Docker, Kubernetes, container orchestration, and cloud-native deployment for data applications |
| sasmp_version | 1.3.0 |
| bonded_agent | 03-devops-engineer |
| bond_type | PRIMARY_BOND |
| skill_version | 2.0.0 |
| last_updated | 2025-01 |
| complexity | intermediate |
| estimated_mastery_hours | 120 |
| prerequisites | ["python-programming","cloud-platforms"] |
| unlocks | ["mlops","big-data"] |
Containerization & Kubernetes
Production-grade container orchestration for data engineering workloads with Docker and Kubernetes.
Quick Start
# Dockerfile for PySpark data application
FROM python:3.12-slim
# Install Java for Spark
RUN apt-get update && apt-get install -y openjdk-17-jdk-headless && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install dependencies first (cache optimization)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY src/ ./src/
COPY config/ ./config/
# Non-root user for security
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
ENV PYTHONPATH=/app
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
ENTRYPOINT ["python", "-m", "src.main"]
Core Concepts
1. Multi-Stage Builds
# Build stage
FROM python:3.12 AS builder
WORKDIR /build
COPY requirements.txt .
RUN pip wheel --no-cache-dir --wheel-dir /wheels -r requirements.txt
# Runtime stage
FROM python:3.12-slim AS runtime
COPY --from=builder /wheels /wheels
RUN pip install --no-cache-dir /wheels/* && rm -rf /wheels
COPY src/ /app/src/
WORKDIR /app
USER 1000
CMD ["python", "-m", "src.main"]
2. Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: etl-worker
labels:
app: etl-worker
spec:
replicas: 3
selector:
matchLabels:
app: etl-worker
template:
metadata:
labels:
app: etl-worker
spec:
containers:
- name: etl-worker
image: company/etl-worker:v1.2.0