General Kubernetes I
1.
What is the purpose of the 'livenessProbe' in a Kubernetes Pod?
To determine if a pod is ready to serve traffic
To restart the pod in case of failure
To terminate the pod if it exceeds resource limits
To check the health of the application running in the pod
2.
What is the primary purpose of a Deployment in Kubernetes?
To create persistent storage for applications
To manage external network traffic
To define the desired state for an application
To configure load balancing for services
3.
Which YAML field is used to specify the number of replicas in a Deployment?
replicationController
replicaCount
replicas
pods
4.
What is the purpose of the 'rollingUpdate' strategy in a Deployment?
To perform a rolling restart of pods
To scale the application horizontally
To enable automatic rollback on failure
To configure rolling updates for external services
5.
In a Kubernetes Deployment, what is the purpose of the 'selector' field?
To define the labels for the pods controlled by the Deployment
To specify the node affinity for the pods
To configure network policies
To define the deployment strategy
6.
Which command is used to scale the number of replicas in a Deployment?
kubectl scale
kubectl resize
kubectl deploy
kubectl replicas
7.
What is the role of a ConfigMap in Kubernetes Deployments?
To store sensitive information like passwords
To define environment variables for a container
To manage the configuration of external services
To configure pod affinity
8.
Which resource is used to define resource constraints (CPU and memory) for a container in a Deployment?
podResources
containerSpec
resources
limitsAndRequests
9.
What is the purpose of the 'NodePort' service type in Kubernetes?
To expose a service externally with a static port on each node
To enable communication between pods in different nodes
To create an internal service accessible only within the cluster
To define a service with a dynamically assigned port
10.
What does the 'kubectl rollout history' command show?
List of nodes in the cluster
History of changes to a Deployment
Logs of a specific pod
Status of persistent volumes
11.
Which Kubernetes object is used for persistent storage in a Deployment?
PersistentVolume
PersistentVolumeClaim
StorageClass
VolumeMount
12.
What is the purpose of the 'initContainers' field in a pod specification?
To define containers that run before the main application container starts
To configure the network settings of the pod
To specify the service account for the pod
To enable GPU support for the pod
13.
How can you roll back a failed deployment in Kubernetes?
kubectl undo
kubectl rollback
kubectl restore
kubectl revert
14.
What is the role of a DaemonSet in Kubernetes?
To ensure that a specific number of pods are running
To deploy a single pod on multiple nodes
To run a pod on every node in the cluster
To manage stateful applications
15.
Which Kubernetes object is used to expose a service within the cluster using a DNS name?
Service
Ingress
Endpoint
ClusterIP
16.
What is the purpose of the 'PodAffinity' rule in a Kubernetes Deployment?
To specify the node on which a pod should be scheduled
To define affinity between pods in the same deployment
To control the access of external traffic to a pod
To ensure that pods are co-located or spread across nodes based on labels
17.
How can you update the image version of a container in a running Deployment?
kubectl set image
kubectl update deployment
kubectl modify container
kubectl change image
18.
What is the purpose of the 'HorizontalPodAutoscaler' in Kubernetes?
To automatically adjust the number of replicas based on resource usage
To horizontally scale the number of nodes in the cluster
To configure automatic pod restarts
To define pod affinity rules
19.
What is the purpose of the 'ServiceAccount' in Kubernetes?
To authenticate users accessing the cluster
To define the security context for a pod
To specify the image used by a container
To assign a set of permissions to pods
20.
How can you expose a Kubernetes service to the internet?
NodePort service type
ClusterIP service type
LoadBalancer service type
Ingress resource