Search Tutorials


Kubernetes MCQ Questions and Answers | JavaInUse

Kubernetes MCQ Questions and Answers

Q. What is Kubernetes?

A. A container management system
B. A cloud computing platform
C. A microservice architecture framework
D. All of the above

Q. What is a Kubernetes cluster composed of?

A. Master node and worker nodes
B. Virtual machines and containers
C. Load balancers and storage units
D. Master node, worker nodes, and a cloud provider

Q. What are the main components of the Kubernetes control plane?

A. etcd, kube-apiserver, kube-scheduler, and kube-controller-manager
B. kubelet, kube-proxy, and Container Runtime
C. kube-dns, Ingress controller, and Service
D. All of the above

Q. What is a pod in Kubernetes?

A. A group of one or more containers with shared storage and network
B. A virtual machine instance running on a node
C. A unit of horizontal scaling in Kubernetes
D. A service that provides load balancing and networking

Q. What is a ReplicaSet in Kubernetes?

A. A group of pods that are managed as a single unit
B. A mechanism to ensure high availability of pods
C. A way to define the desired state for a pod or a group of pods
D. A method to scale the number of pods in a deployment

Q. What is a Deployment in Kubernetes?

A. A way to update applications without downtime
B. A declarative way to manage pods and ReplicaSets
C. A method to roll back to a previous version of an application
D. All of the above

Q. What is a Service in Kubernetes?

A. An abstract way to expose an application running on a set of pods
B. A type of pod that provides network connectivity to other pods
C. A load balancer that distributes network traffic across multiple pods
D. A way to define the desired state for network connectivity

Q. What is a Namespace in Kubernetes?

A. A way to isolate resources and objects within a cluster
B. A logical grouping of objects with a unique name
C. A security mechanism to control access to resources
D. All of the above

Q. What is a DaemonSet in Kubernetes?

A. A way to run a single instance of a pod on each node
B. A method to ensure that all nodes run a copy of a pod
C. A type of pod that runs in the background and performs maintenance tasks
D. A mechanism to distribute pods evenly across nodes





Q. What is a PersistentVolume in Kubernetes?

A. A storage resource in the cluster that is provisioned dynamically
B. A type of volume that is mounted into a pod and exists as long as the pod is running
C. A network storage solution that provides persistent storage for containers
D. A volume that provides storage independent of the lifecycle of individual pods

Q. What is a ConfigMap in Kubernetes?

A. A way to inject configuration data into containers
B. A type of volume that stores configuration files for pods
C. A mechanism to dynamically configure container settings at runtime
D. All of the above

Q. What is a Secret in Kubernetes?

A. A type of ConfigMap that stores sensitive data
B. A way to manage and store sensitive information, such as passwords and tokens
C. An encrypted volume that can be mounted into pods
D. A security mechanism to control access to resources

Q. What is a Kubernetes Ingress?

A. A rule that allows inbound connections to reach the cluster
B. A type of Service that provides external access to services within a cluster
C. A load balancer that distributes incoming network traffic across multiple services
D. A way to configure routing and load balancing for incoming HTTP/HTTPS traffic

Q. What is a Kubernetes HPA (Horizontal Pod Autoscaler)?

A. A mechanism to automatically scale the number of pods based on resource utilization
B. A way to dynamically adjust the resources allocated to a pod based on demand
C. A method to distribute network traffic across multiple pods
D. A tool for monitoring and optimizing resource utilization in a cluster

Q. What is a Kubernetes operator?

A. A method to extend the Kubernetes API with custom resources
B. A tool for automating operational tasks and managing the cluster
C. A way to package and distribute applications on Kubernetes
D. A framework for building custom controllers that extend the Kubernetes control plane

Q. Which of the following best describes a benefit of using Kubernetes for container orchestration?

A.
Kubernetes provides automatic scaling of containers based on demand, ensuring efficient utilization of resources.
B.
Kubernetes simplifies the process of deploying and managing containers across a cluster of machines.
C.
Kubernetes offers built-in support for load balancing, distributing network traffic across multiple containers.
D.
Kubernetes enables easy rolling updates and rollbacks of containerized applications, minimizing downtime.

Q. Which YAML file is used to define a Kubernetes Pod?

A.
apiVersion: v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-container
          image: my-image:latest

B.
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: my-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080

C.
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
    - name: container-1
      image: image-1
    - name: container-2
      image: image-2

D.
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: my-daemonset
spec:
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-container
          image: my-image:latest

Q. What is the purpose of a Kubernetes Deployment?

A.
To define and manage a set of Pods and ensure they are always running.
B.
To create and manage a network of interconnected containers.
C.
To provide load balancing and distribute network traffic across multiple Pods.
D.
To automatically scale the number of Pods based on resource utilization.

Q. Which of the following is a valid Kubernetes object type?

A.
kind: PodTemplate
B.
kind: ReplicaSet
C.
kind: ServiceAccount
D. All of the above

Q. How can you check the status of all Pods in a Kubernetes cluster?

A.
kubectl get pods -o wide
B.
kubectl describe pods
C.
kubectl get pod -o json
D.
kubectl logs pods

Q. What is the purpose of a Kubernetes Service?

A.
To define and manage a set of Pods that work together to provide a service.
B.
To provide load balancing and distribute network traffic across multiple Pods.
C.
To create and manage persistent storage volumes for Pods.
D.
To automatically scale the number of Pods based on resource utilization.

Q. Which of the following is a valid way to expose a Service in Kubernetes?

A.
kind: Service
spec:
  type: ClusterIP
B.
kind: Service
spec:
  type: NodePort
C.
kind: Service
spec:
  type: LoadBalancer
D.
All of the above

Q. How can you delete a Kubernetes Deployment named "my-deployment"?

A.
kubectl delete deployment my-deployment
B.
kubectl remove deployment my-deployment
C.
kubectl rm deployment my-deployment
D.
kubectl delete deploy my-deployment

Q. What is a Kubernetes Namespace used for?

A.
To provide a way to group and isolate objects within a Kubernetes cluster.
B.
To create separate clusters within a single Kubernetes installation.
C.
To define different configurations for the same set of objects.
D.
To provide access control and security for specific objects.