0
0
Kubernetesdevops~10 mins

Multi-container Pods concept in Kubernetes - Interactive Code Practice

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

Complete the code to define a pod with two containers.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: multi-container-pod
spec:
  containers:
  - name: container1
    image: nginx
  - name: [1]
    image: busybox
Drag options to blanks, or click blank then click option'
Amain
Bapp
Csidecar
Dcontainer2
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same name as the first container causes errors.
Leaving the name blank is invalid.
2fill in blank
medium

Complete the code to add a shared volume to both containers in the pod.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: shared-volume-pod
spec:
  volumes:
  - name: shared-data
    emptyDir: {}
  containers:
  - name: app
    image: busybox
    volumeMounts:
    - name: [1]
      mountPath: /data
  - name: sidecar
    image: alpine
    volumeMounts:
    - name: shared-data
      mountPath: /cache
Drag options to blanks, or click blank then click option'
Ashared-data
Bdata
Ccache
Dvolume1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different name than the volume causes the mount to fail.
Forgetting to define the volume in the pod spec.
3fill in blank
hard

Fix the error in the pod spec by completing the missing field.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: error-pod
spec:
  containers:
  - name: app
    image: nginx
  - name: sidecar
    [1]: alpine
Drag options to blanks, or click blank then click option'
Aimage
Bcommand
Cargs
DvolumeMounts
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'command' or 'args' without specifying 'image' causes pod creation failure.
Misspelling 'image' field.
4fill in blank
hard

Fill both blanks to define environment variables for the containers.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: env-pod
spec:
  containers:
  - name: app
    image: nginx
    env:
    - name: [1]
      value: "production"
  - name: sidecar
    image: busybox
    env:
    - name: [2]
      value: "debug"
Drag options to blanks, or click blank then click option'
AENV_MODE
BLOG_LEVEL
CAPP_MODE
DDEBUG_MODE
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or invalid environment variable names.
Using the same name for both containers' environment variables.
5fill in blank
hard

Fill all three blanks to complete the pod spec with resource limits and requests.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: resource-pod
spec:
  containers:
  - name: app
    image: nginx
    resources:
      limits:
        cpu: [1]
        memory: [2]
      requests:
        cpu: [3]
Drag options to blanks, or click blank then click option'
A500m
B256Mi
C250m
D1Gi
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing units like '500' instead of '500m' for CPU.
Setting requests higher than limits causes scheduling errors.