0
0
MLOpsdevops~10 mins

Kubernetes for ML workloads in MLOps - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a Kubernetes pod that runs a machine learning container.

MLOps
apiVersion: v1
kind: Pod
metadata:
  name: ml-pod
spec:
  containers:
  - name: ml-container
    image: [1]
Drag options to blanks, or click blank then click option'
Atensorflow/tensorflow:latest
Bubuntu:latest
Cnginx:alpine
Dmysql:5.7
Attempts:
3 left
💡 Hint
Common Mistakes
Using a web server image like nginx instead of an ML image.
Using a database image like mysql which is unrelated to ML workloads.
2fill in blank
medium

Complete the code to specify resource limits for the ML container in the pod.

MLOps
spec:
  containers:
  - name: ml-container
    resources:
      limits:
        cpu: [1]
Drag options to blanks, or click blank then click option'
A2Gi
B2
C2MB
D500m
Attempts:
3 left
💡 Hint
Common Mistakes
Using memory units like '2Gi' for CPU limits.
Using plain numbers without units for CPU limits.
3fill in blank
hard

Fix the error in the YAML to mount a volume for ML data inside the container.

MLOps
spec:
  containers:
  - name: ml-container
    volumeMounts:
    - name: data-volume
      mountPath: [1]
  volumes:
  - name: data-volume
    persistentVolumeClaim:
      claimName: ml-data-pvc
Drag options to blanks, or click blank then click option'
A/var/lib/data
B/data-volume
C/mnt/data
D/etc/data
Attempts:
3 left
💡 Hint
Common Mistakes
Using mount paths that are not directories or reserved system paths.
Using the volume name as the mount path.
4fill in blank
hard

Fill both blanks to create a Kubernetes Job that runs an ML training script once.

MLOps
apiVersion: batch/v1
kind: Job
metadata:
  name: ml-training-job
spec:
  template:
    spec:
      containers:
      - name: trainer
        image: [1]
        command: ["python", [2]]
      restartPolicy: Never
Drag options to blanks, or click blank then click option'
Aml-training-image:latest
B"train.py"
Capp.py
Dtensorflow/tensorflow:latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic TensorFlow image without the training script.
Using the wrong script name in the command.
5fill in blank
hard

Fill all three blanks to define a Kubernetes Deployment for an ML model server with 3 replicas and environment variable.

MLOps
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ml-model-server
spec:
  replicas: [1]
  selector:
    matchLabels:
      app: ml-server
  template:
    metadata:
      labels:
        app: ml-server
    spec:
      containers:
      - name: model-server
        image: [2]
        env:
        - name: MODEL_NAME
          value: [3]
Drag options to blanks, or click blank then click option'
A3
Bml-model-server:latest
C"image-classifier"
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replicas to 1 instead of 3.
Not quoting the environment variable value.
Using wrong image names.