Kubernetes Pods VIII
1.
How can you set the termination grace period for a pod in Kubernetes?
Use the `terminationGracePeriodSeconds` field in the pod manifest
Specify `gracePeriodSeconds` in the `containers` field
Pods do not have a termination grace period
Use the `gracePeriod` field in the pod manifest
2.
What is the purpose of the `livenessProbe` in a container spec?
To determine if the container is alive and responsive
To set the initial delay before starting the container
There is no such probe type
To check if the container is ready to accept traffic
3.
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 cannot expose pods within the same namespace
By using an ExternalName service
4.
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
5.
What is the purpose of the `ephemeralContainers` field in a pod spec?
To define containers with short lifespans
To manage containers during pod creation
There is no such field
To store containers with ephemeral storage
6.
What is the purpose of the `schedulerName` field in a pod manifest?
There is no such field
To set the scheduler for the pod
To configure scheduling policies for containers
To specify the pod's scheduler options
7.
What is the purpose of the `emptyDir` volume type in a pod?
To create an empty directory in the pod
To mount an empty volume
There is no such volume type
To create temporary storage that is deleted when the pod is removed
8.
How can you set the resource requests for both CPU and memory in a container spec?
Use the `requests` field in the container spec
Set requests individually for CPU and memory
Resource requests cannot be set for both CPU and memory
Use the `resources` field in the pod manifest
9.
How can you set the CPU affinity for a container in a pod?
Use the `affinity` field in the container spec
Set CPU affinity in the `containers` field
CPU affinity cannot be set for containers
Use the `resources` field in the container spec
10.
What is the purpose of the `readOnlyRootFilesystem` field in a container spec?
To prevent writes to the container's root filesystem
To make the root filesystem read-only for security reasons
There is no such field
To limit access to the root filesystem
11.
How can you set environment variables for all containers in a pod?
Use the `env` field in the pod manifest
Set environment variables in the `containers` field
Environment variables are set individually for each container
Use the `envFrom` field in the pod manifest
12.
What is the purpose of the `nodeName` field in a pod manifest?
To specify the name of the pod
To set the node where the pod should be scheduled
There is no such field
To define node affinity for the pod
13.
What is the purpose of the `initContainers` field in a pod manifest?
To specify containers that run before the main container starts
To configure the initialization process for the pod
There is no such field
To set container initialization options
14.
How can you limit the number of pod restarts within a specified timeframe?
Use the `restartCount` field in the pod manifest
Specify restart limits in the `containers` field
Pod restarts cannot be limited
Use the `restartPolicy` field in the pod manifest
15.
What is the purpose of the `externalIPs` field in a Service manifest?
To define external IP addresses for the pod
To specify IPs for external access to the service
There is no such field
To configure the service's DNS resolver
16.
What is the purpose of the `imagePullPolicy` field in a container spec?
To set the policy for pulling container images
To define the image pull strategy for the container
There is no such field
To configure the image registry for the container
17.
How can you specify the resource requests for a specific container in a multi-container pod?
Use the `requests` field in the pod manifest
Set requests individually for each container
Resource requests are the same for all containers in a pod
Use the `resources` field in the container spec
18.
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
19.
What is the purpose of the `sessionAffinity` field in a Service manifest?
To define session affinity for the service
To configure session persistence for the service
There is no such field
To set the service's affinity policies
20.
How can you specify environment variables for a container using a ConfigMap?
Use the `env` field in the pod manifest
Reference the ConfigMap in the `envFrom` field
Specify the ConfigMap in the `env` field
Environment variables cannot be set using ConfigMaps