Kubernetes Pods VII
1.
How can you specify the image pull policy for a container in a pod?
Use the `imagePullPolicy` field in the pod manifest
Specify the policy in the `containers` field
Containers do not have an image pull policy
Use the `pullPolicy` field in the container spec
2.
How can you expose a pod to external traffic in a Kubernetes cluster?
Use a ClusterIP service
By creating an Ingress resource
Pods cannot be exposed to external traffic
Use an ExternalName service
3.
How can you mount a Secret as a volume in a pod?
Use the `mountSecret` field in the pod manifest
Reference the Secret in the `volumes` field
Mounting Secrets as volumes is not supported
Use the `secretVolumes` field in the container spec
4.
How can you set affinity rules based on pod labels for a pod?
Use the `podAffinity` field in the pod manifest
Set affinity rules in the `containers` field
Affinity rules cannot be based on pod labels
Use the `affinity` field in the pod manifest
5.
How can you specify resource limits for both CPU and memory in a container?
Use the `limits` field in the container spec
Set limits individually for CPU and memory
Resource limits cannot be set for both CPU and memory
Use the `resources` field in the pod manifest
6.
What is the purpose of the `retries` field in a liveness probe?
To set the number of retries before considering the container unhealthy
To define the retry interval for the liveness probe
There is no such field
To configure the maximum retry duration for the liveness probe
7.
How can you set a delay before starting a container in a pod?
Use the `startupDelay` field in the container spec
Set a delay in the `containers` field of the pod manifest
Containers do not support startup delays
Use the `startupProbe` field in the container spec
8.
What is the purpose of the `secrets` volume type in a pod?
To store confidential information securely
To encrypt the contents of the volume
There is no such volume type
To mount data stored in a Kubernetes Secret
9.
What is the purpose of the `readOnly` field in a volume spec?
To prevent writes to the volume
To make the volume read-only for security reasons
To limit access to the volume
There is no such field
10.
How can you set a priority for a pod in a Kubernetes cluster?
Use the `priority` field in the pod manifest
Specify the priority during pod creation
Pod priority is not configurable
Use the `podPriority` field in the pod manifest
11.
What is the purpose of the `hostNetwork` field in a pod manifest?
To expose the pod directly to the host network
To configure the pod's DNS resolver
There is no such field
To set the network policy for the pod
12.
What is the purpose of the `dnsConfig` field in a pod manifest?
To configure the pod's DNS resolver
To specify DNS policies for the pod
There is no such field
To set DNS options for containers
13.
How can you set a deadline for a pod to complete its execution in Kubernetes?
Use the `timeoutSeconds` field in the pod manifest
Specify `deadlineSeconds` in the `containers` field
Pods do not have a deadline for execution
Use the `activeDeadlineSeconds` field in the pod manifest
14.
What is the purpose of the `nodeSelector` field in a pod manifest?
To select nodes based on labels
There is no such field
To specify node affinity for the pod
To define the pod's DNS resolver
15.
What is the purpose of the `hostIPC` field in a pod manifest?
To expose the pod directly to the host IPC namespace
To configure the pod's IPC namespace
There is no such field
To set IPC policies for containers
16.
How can you run a command before a container starts in a pod?
Use the `preStart` lifecycle hook in the container spec
Specify a command in the `initContainers` field
Containers do not support pre-start commands
Use the `beforeStart` field in the container spec
17.
What is the purpose of the `volumes` field in a pod manifest?
To specify the number of volumes for the pod
To define storage requirements for the pod
There is no such field
To list and configure volumes for containers
18.
What is the purpose of the `schedulerName` field in a pod manifest?
To specify the scheduler for the pod
To configure scheduling policies for containers
There is no such field
To set the pod's scheduler options
19.
How can you set resource quotas for a pod in a namespace?
Use the `resourceQuotas` field in the pod manifest
Reference the resource quotas in the `limits` field
Resource quotas cannot be set for a pod
Use the `resources` field in the pod manifest
20.
What is the purpose of the `affinity` field in a pod manifest?
To express preferences for scheduling pods on specific nodes
To avoid placing pods of the same type on the same node
There is no such field
To define pod affinity rules