Kubernetes Pods VI
1.
How can you set the working directory for a container in a pod?
Use the `workingDir` field in the pod manifest
Specify the working directory in the `containers` field
Containers do not have a working directory
Use the `cwd` field in the container spec
2.
How can you limit the amount of CPU resources a container can use in a pod?
Use the `cpuLimit` field in the pod manifest
Set limits in the container spec directly
CPU limits cannot be set for containers
Use the `limits` field in the pod manifest
3.
How can you scale the number of replicas in a StatefulSet without causing service disruption?
kubectl scale statefulset
Update the replicas field in the StatefulSet manifest
StatefulSets cannot be scaled without disruption
Use the `kubectl set replicas` command
4.
How can you expose a pod to other pods in a different namespace using a Service?
By using a ClusterIP service
By specifying `externalIPs` in the service manifest
Services cannot expose pods across namespaces
By using an ExternalName service
5.
How can you specify resource requirements for a pod?
Use the `requests` field in the pod manifest
Set requirements in the `containers` field
Resource requirements cannot be specified
Use the `resources` field in the pod manifest
6.
What is the purpose of the `ephemeralStorage` resource in a container spec?
To allocate storage for container logs
To specify the amount of ephemeral storage available
To set the storage quota for a pod
There is no such resource
7.
What is the purpose of the `activeDeadlineSeconds` field in a pod manifest?
To specify the time a pod is allowed to be active
To define the pod's overall execution time
There is no such field
To set the timeout for a liveness probe
8.
How can you expose multiple ports in a pod using a Service?
Create multiple services for each port
Specify a port range in the service manifest
Services support only a single port
Use the `ports` field in the service manifest
9.
What is the purpose of the `projected` volume type in a pod?
To project external files into the pod
To create a volume projection
There is no such volume type
To combine multiple volume sources into one
10.
How can you run a command in a specific container within a multi-container pod?
kubectl exec -c container-name pod-name command
kubectl run -c container-name command
Command execution is not possible in multi-container pods
kubectl attach -c container-name pod-name command
11.
What is the purpose of the `subdomain` field in an Ingress resource?
To set the root domain for the Ingress
To configure SSL certificates
There is no such field
To define subdomains for routing
12.
What is the purpose of the `ephemeralContainers` field in a pod status?
To list containers with short lifespans
To manage containers during pod creation
There is no such field
To store containers with ephemeral storage
13.
How can you schedule a pod on a node with a specific label using node affinity?
Use the `nodeAffinity` field in the pod manifest
Specify the label in the `nodeSelector` field
Scheduling based on node labels is not supported
Use the `affinity` field in the pod manifest
14.
What is the purpose of the `maxUnavailable` field in a rolling update strategy?
To set the maximum number of pods that can be unavailable during a rolling update
To specify the maximum update rate during a rolling update
There is no such field
To control the number of replicas in a deployment
15.
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
16.
What is the purpose of the `preStop` lifecycle hook in a container spec?
To run a command before the container stops
To run a command after the container stops
To handle cleanup tasks when the container terminates
There is no such hook
17.
How can you set an environment variable for a container using a Secret in a specific namespace?
Use the `env` field in the pod manifest
Reference the Secret in the `envFrom` field
Specify the namespace in the `env` field
Environment variables cannot be set using Secrets
18.
What is the purpose of the `allowPrivilegeEscalation` field in a pod security context?
To allow containers to run with escalated privileges
To restrict containers from privilege escalation
There is no such field
To enable privilege escalation for specific containers
19.
What is the purpose of the `hostAliases` field in a pod manifest?
To specify aliases for the pod hostname
To define host mappings for the pod
There is no such field
To configure the pod's DNS resolver
20.
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