Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same name as the first container causes errors.
Leaving the name blank is invalid.
✗ Incorrect
The second container in the pod is named 'container2' to clearly identify it as the second container.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
The volumeMount name must match the volume name 'shared-data' to mount the shared volume correctly.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'command' or 'args' without specifying 'image' causes pod creation failure.
Misspelling 'image' field.
✗ Incorrect
Each container must have an 'image' field specifying the container image to run.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or invalid environment variable names.
Using the same name for both containers' environment variables.
✗ Incorrect
Common environment variable names are 'ENV_MODE' for app mode and 'LOG_LEVEL' for logging level.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing units like '500' instead of '500m' for CPU.
Setting requests higher than limits causes scheduling errors.
✗ Incorrect
CPU limits are set to '500m' (0.5 CPU), memory limits to '256Mi', and CPU requests to '250m' (0.25 CPU) to allocate resources properly.