Kubernetes Pods IV
1.
How can you assign a priority to pods using PriorityClasses?
Specify the priority in the pod manifest directly
Use the `priority` field in the pod manifest
Priority cannot be assigned to pods
Reference the PriorityClass in the pod manifest
2.
What is the purpose of the `memory` resource in a container spec?
To set the CPU memory limit for the container
To define the container's memory requirements
To allocate a fixed amount of memory for the container
There is no such resource
3.
How can you check the resource usage of a pod in a specific namespace?
kubectl top namespace
kubectl describe namespace pod-name
kubectl top pod -n namespace
Resource usage cannot be checked by namespace
4.
How can you specify a custom hostname for a pod?
Use the `hostname` field in the pod manifest
Set the hostname as an environment variable
Pods cannot have custom hostnames
Use the `nodeName` field in the pod manifest
5.
What is the purpose of the `postStart` lifecycle hook in a container spec?
To run a command after the container starts
To run a command before the container starts
To handle cleanup tasks when the container terminates
There is no such hook
6.
How can you share storage volumes between containers in the same pod?
Use the `volumes` field in the pod manifest
Mount the same volume in both containers
Share the storage directory using a service
Containers cannot share storage volumes
7.
What is the purpose of the `readOnly` field in a volume mount?
To prevent modifications to the mounted volume
To make the volume read-only for security reasons
To limit access to the volume
There is no such field
8.
What is the purpose of the `terminationGracePeriodSeconds` field in a pod manifest?
To define the time it takes for a pod to start
To specify the time allowed for a pod to terminate gracefully
To set the timeout for a readiness probe
There is no such field
9.
How can you specify an init container in a pod manifest?
Use the `initContainers` field in the pod manifest
Specify the `initContainer` attribute for each container
Init containers cannot be specified
Use the `containers` field with an `init` flag
10.
What is the primary role of the `kubelet` in a Kubernetes cluster?
Scheduling pods
Exposing services
Monitoring resource usage
Managing containers on a node
11.
How can you pass environment variables to a container using a ConfigMap?
Use the `env` field in the ConfigMap manifest
Specify the ConfigMap as an environment variable in the pod manifest
Reference the ConfigMap in the `envFrom` field
Environment variables cannot be passed using ConfigMaps
12.
How can you prevent a pod from being scheduled on specific nodes?
Use the `nodeSelector` field in the pod manifest
Specify `nodeTaints` for the nodes
Pods cannot be restricted from specific nodes
Set `nodeAffinity` to disallow specific nodes
13.
What is the purpose of the `rollingRestartStrategy` field in a StatefulSet manifest?
To control the order of pod restarts
To specify the number of replicas in a rolling restart
Rolling restarts are not supported for StatefulSets
To define the rolling restart behavior
14.
How can you expose a pod to other pods in the same namespace using a Service?
By using a ClusterIP service
By specifying `externalIPs` in the service manifest
Services automatically expose pods to other pods
By using a NodePort service
15.
What is the purpose of the `ephemeralContainers` field in a pod manifest?
To specify short-lived containers in the pod
To configure containers with ephemeral storage
There is no such field
To define containers that run only during pod creation
16.
What is the purpose of the `restartAlways` restart policy in a pod manifest?
To restart the pod indefinitely
To restart the pod only when manually triggered
To restart the pod if it fails
There is no such restart policy
17.
What is the purpose of the `podAntiAffinity` field in a StatefulSet manifest?
To express preferences for scheduling pods on specific nodes
To avoid placing pods of the same StatefulSet on the same node
To specify the affinity between pods
There is no such field
18.
How can you grant a service account additional permissions in Kubernetes?
Update the service account manifest
Modify the role assigned to the service account
Service accounts cannot have additional permissions
Grant permissions directly to the service account
19.
What is the purpose of the `downwardAPI` volume in a pod?
To provide storage for the pod
To expose pod information as files
To download data from an external API
There is no such volume type
20.
How can you limit the amount of CPU and memory resources a container can use in a pod?
Use the `resources` field in the pod manifest
Set limits in the container spec directly
CPU and memory limits cannot be set for containers
Use the `quota` field in the pod manifest