Kubernetes Flashcards

1
Q

What is Kubernetes, and who initially created it?

A

Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform for automating the deployment, scaling, and management of containerized applications. It was initially created by Google.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the primary role of the Kubernetes API server?

A

The Kubernetes API server is responsible for exposing the Kubernetes API, acting as the communication point between clients and the Kubernetes cluster. It allows users to interact with the cluster to manage applications and resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Cube CTL (kubectl), and what is its purpose?

A

Cube CTL, often referred to as kubectl, is the Kubernetes command-line interface. Its purpose is to manage Kubernetes clusters, deploy applications, inspect cluster resources, and interact with the Kubernetes API server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a Kubernetes context, and why is it useful?

A

A Kubernetes context is a group of access parameters that allow you to connect to a specific Kubernetes cluster. It includes the cluster name, user, and namespace. Contexts are useful for managing connections to multiple clusters and specifying which cluster kubectl commands should target.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some of the primary functionalities that Kubernetes provides?

A

Kubernetes provides functionalities such as service discovery, load balancing, rolling updates, scaling, container orchestration, and automated deployment management.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you check if your Kubernetes installation is running correctly using kubectl?

A

You can use the command kubectl cluster-info to check if your Kubernetes installation is running correctly. It will display information about the Kubernetes master and the services it exposes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of a Kubernetes context, and how does it help manage multiple clusters?

A

A Kubernetes context is used to specify which cluster, user, and namespace should be used for kubectl commands. It helps manage multiple clusters by allowing users to switch between different contexts, making it easier to work with different clusters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the default location for the kubectl configuration file, and what does it contain?

A

The default location for the kubectl configuration file is ~/.kube/config. This file contains information about clusters, users, and contexts, allowing kubectl to connect to the correct Kubernetes clusters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you list the available contexts in kubectl, and how can you switch between them?

A

You can list available contexts using the command kubectl config get-contexts. To switch between contexts, you can use the kubectl config use-context command followed by the context name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the role of the Kubernetes API server, and why is it a critical component of a Kubernetes cluster?

A

The Kubernetes API server acts as the central communication point for clients (such as kubectl) and the Kubernetes cluster. It exposes the Kubernetes API, allowing users to manage cluster resources. It is a critical component because all cluster operations go through the API server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are worker nodes in a Kubernetes cluster, and what role do they play?

A

Worker nodes are machines in a Kubernetes cluster responsible for running containers. They execute the tasks assigned by the Kubernetes master, such as running pods and containers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a pod in Kubernetes, and why is it the smallest deployable unit?

A

A pod is the smallest deployable unit in Kubernetes, representing a single instance of a running process. It can contain one or more containers sharing the same network and storage resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can you check the status of a Kubernetes cluster using kubectl?

A

ou can use the command kubectl cluster-info to check the status of a Kubernetes cluster. It displays information about the cluster’s master and services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is kubectl, and what is its primary purpose?

A

Kubectl is the Kubernetes command-line tool used to interact with a Kubernetes cluster. Its primary purpose is to manage and control Kubernetes resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you list all the available contexts in your kubectl configuration?

A

You can list all available contexts in your kubectl configuration using the command kubectl config get-contexts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a Kubernetes context, and why is it useful?

A

A Kubernetes context is a group of access parameters that specify which cluster, user, and namespace should be used for kubectl commands. It is useful for managing multiple clusters and environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How can you switch between different Kubernetes contexts?

A

You can switch between different Kubernetes contexts using the kubectl config use-context command followed by the context name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are some options for running Kubernetes locally on your desktop or laptop?

A

You can run Kubernetes locally using tools like Docker Desktop, MiniKube, Kind (Kubernetes in Docker), or MicroK8s.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How can you enable Kubernetes in Docker Desktop, and what is the recommended setup for Windows users?

A

To enable Kubernetes in Docker Desktop, you can go to settings and check the “Enable Kubernetes” option. The recommended setup for Windows users is to use WSL 2 as the base engine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are the advantages of using MiniKube for local Kubernetes development?

A

MiniKube allows you to run a single-node Kubernetes cluster locally, making it suitable for testing and development. It is easy to set up and provides a consistent Kubernetes environment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is Kind (Kubernetes in Docker), and how does it differ from other local Kubernetes solutions?

A

Kind is a tool that runs Kubernetes clusters inside Docker containers. It is lightweight and can emulate multiple control planes and worker nodes, making it useful for testing and development.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the Kubernetes Control Plane, and what components does it consist of?

A

The Kubernetes Control Plane is the central management entity of a Kubernetes cluster. It consists of components like the API Server, Controller Manager, Scheduler, and etcd.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the role of the Kubernetes API Server, and why is it considered the frontend to the cluster?

A

The Kubernetes API Server is the central component that serves the Kubernetes API. It acts as the frontend to the cluster, receiving and processing requests from users and clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is etcd in Kubernetes, and what purpose does it serve?

A

etcd is a distributed key-value store that Kubernetes uses to store all of its cluster data. It serves as the cluster’s source of truth and configuration store.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is the Kubernetes Kubelet, and what is its responsibility within a node?

A

The Kubernetes Kubelet is an agent running on each node in the cluster. Its responsibility is to ensure that containers are running in a Pod and to communicate with the Kubernetes Control Plane.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is a Kubernetes Deployment, and how does it ensure application availability?

A

A Kubernetes Deployment is an object that manages the deployment of replica Pods. It ensures application availability by maintaining the desired number of replicas and rolling updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What is a Kubernetes Service, and why is it essential for inter-pod communication?

A

A Kubernetes Service is an abstraction that exposes a set of Pods as a network service. It is essential for inter-pod communication because it provides a stable IP and DNS name for accessing Pods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is a Persistent Volume (PV) in Kubernetes, and how does it ensure data persistence?

A

A Persistent Volume (PV) is a cluster-wide storage resource that can be mounted by Pods. It ensures data persistence by abstracting the underlying storage infrastructure and providing a uniform interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is a Kubernetes Namespace, and why is it used?

A

A Kubernetes Namespace is a way to create virtual clusters within a physical cluster. It is used to organize and isolate resources, making it easier to manage multi-tenant environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What is the purpose of tagging Docker images with version numbers or labels?

A

Tagging Docker images with version numbers or labels allows you to manage and track different versions of your images. It helps ensure consistency and facilitates image updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

How can you delete a Docker image from your local repository?

A

You can delete a Docker image from your local repository using the docker rmi command followed by the image name or ID.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is a context in Kubernetes?

A

A context in Kubernetes contains connection information to a Kubernetes cluster, including the cluster name, user, and namespace.

33
Q

How can you list all the namespaces in a Kubernetes cluster?

A

You can list all namespaces using the kubectl get namespaces or kubectl get ns command.

34
Q

What is the purpose of namespaces in Kubernetes?

A

Namespaces in Kubernetes allow you to group resources and create logical partitions within a cluster, helping with resource organization and isolation.

35
Q

How can you switch between namespaces using kubectl?

A

You can switch between namespaces using the kubectl config set-context –current –namespace=<namespace> command.</namespace>

36
Q

What is the command to create a new namespace in Kubernetes?

A

You can create a new namespace using the kubectl create ns <namespace-name> command.</namespace-name>

37
Q

What is the primary role of the master node in a Kubernetes cluster?

A

The master node in Kubernetes is responsible for managing the overall control and orchestration of the cluster. It hosts various essential components and services.

38
Q

Name the key components/services running on the master node in Kubernetes.

A

The key components/services on the master node include the API Server, etcd, Controller Manager, and Cloud Controller Manager.

39
Q

What is the role of the API Server in Kubernetes?

A

The API Server in Kubernetes exposes the Kubernetes API, serving as the entry point for client communication with the cluster. It handles API requests and updates the cluster’s state.

40
Q

What is etcd in Kubernetes, and what purpose does it serve?

A

etcd is a distributed key-value store used as the cluster’s data store. It stores configuration data and the current state of the cluster, making it the single source of truth for Kubernetes.

41
Q

What is the role of the Controller Manager in Kubernetes?

A

The Controller Manager in Kubernetes manages various controllers responsible for maintaining the desired state of different objects in the cluster, such as deployments, replica sets, and services.

42
Q

What is the Cloud Controller Manager, and why is it important?

A

The Cloud Controller Manager interacts with cloud provider-specific APIs to manage resources like nodes, load balancers, and storage in a cloud-based Kubernetes cluster. It abstracts cloud provider dependencies.

43
Q

What is the primary role of worker nodes in a Kubernetes cluster?

A

Worker nodes in Kubernetes are responsible for running application containers. They execute the workloads assigned to them by the master node.

44
Q

Name the key components/services running on a worker node in Kubernetes.

A

The key components/services on a worker node include the Container Runtime, Kubelet, and Kube Proxy.

45
Q

What is the role of the Container Runtime in Kubernetes worker nodes?

A

The Container Runtime is responsible for running and managing containers on the worker node. It interacts with the container images and executes containers as specified.

46
Q

What is the Kubelet, and what does it do in a Kubernetes worker node?

A

The Kubelet is an agent running on each worker node. It ensures that containers are running in a Pod as specified in the Pod specifications. It communicates with the master node.

47
Q

What is the role of Kube Proxy in Kubernetes worker nodes?

A

Kube Proxy is a network proxy that manages network rules on nodes. It maintains network connectivity between Pods and services within the cluster.

48
Q

Can worker nodes run Kubernetes services like the API Server or etcd?

A

No, worker nodes are primarily responsible for running application containers. Services like the API Server and etcd run on the master node.

49
Q

What is a Pod in Kubernetes?

A

A Pod is the smallest deployable unit in Kubernetes, representing a single instance of a running process in the cluster. It can contain one or more containers that share the same network and storage.

50
Q

Why are Pods used in Kubernetes?

A

Pods are used to group one or more containers that need to work together closely. They share the same network namespace, making it easier for them to communicate with each other.

51
Q

How can multiple containers within a Pod communicate with each other?

A

Containers within the same Pod can communicate with each other using localhost as they share the same network namespace.

52
Q

What is the purpose of the Pause container in a Pod?

A

The Pause container in a Pod serves as a placeholder and ensures that the Pod’s network and storage namespaces are created. It is essential for maintaining the Pod’s network connectivity.

53
Q

How does Kubernetes manage the placement of Pods on worker nodes?

A

Kubernetes is responsible for scheduling Pods to worker nodes based on resource requirements, node availability, and other factors. The Kube Scheduler is responsible for this task.

54
Q

What happens if a Pod contains multiple containers, and one of them fails?

A

If a Pod contains multiple containers, they share the same lifecycle. If one container within the Pod fails, it can lead to the termination of the entire Pod.

55
Q

What are Labels in Kubernetes?

A

Labels are key-value pairs associated with objects in Kubernetes, allowing users to organize and categorize resources. They are used for various purposes like filtering, selecting, and grouping resources.

56
Q

How can Labels be applied to Kubernetes resources?

A

Labels can be applied to Kubernetes resources by including them in the metadata section of the resource’s configuration, such as Pod or Service definitions.

57
Q

What is the purpose of Selectors in Kubernetes?

A

Selectors are used to filter and select resources based on their labels. They allow users to query resources that match specific label criteria.

58
Q

Can multiple Labels be assigned to a single resource in Kubernetes?

A

Yes, multiple Labels can be assigned to a single resource in Kubernetes. Labels are flexible and can be used to represent various characteristics of a resource.

59
Q

What are Annotations in Kubernetes, and how are they different from Labels?

A

Annotations are additional metadata that can be attached to Kubernetes resources. Unlike Labels, which are used for identification and selection, Annotations are used for providing additional information or comments about a resource.

60
Q

Give an example of when Labels and Selectors might be used in Kubernetes.

A

Labels and Selectors can be used when setting up Network Policies to define which Pods can communicate with each other based on their labels. For example, allowing only Pods labeled as “app=frontend” to communicate with Pods labeled as “app=backend.”

61
Q

What is a Deployment in Kubernetes?

A

A Deployment is a Kubernetes resource that manages the deployment and scaling of replica Pods. It ensures a specified number of replicas are running and handles updates and rollbacks.

62
Q

What is the primary purpose of using Deployments in Kubernetes?

A

The primary purpose of using Deployments is to maintain the desired state of applications by managing replica Pods. They provide features like rolling updates and rollback capabilities.

63
Q

How can you create a Deployment in Kubernetes using YAML configuration?

A

You can create a Deployment in Kubernetes using a YAML configuration file that specifies the desired number of replicas, the container image, and other deployment settings.

64
Q

What is a Rolling Update in the context of Kubernetes Deployments?

A

A Rolling Update is a strategy used by Deployments to update the running Pods to a new version gradually. It ensures that a specified number of Pods are running the new version while phasing out the old ones.

65
Q

How does a Deployment handle Rollbacks in Kubernetes?

A

If a Deployment update fails or causes issues, Kubernetes allows you to perform a rollback to a previous known-good version. The Deployment keeps a history of revisions, making rollbacks straightforward.

66
Q

Can you specify resource limits for containers within a Deployment?

A

Yes, resource limits for CPU and memory can be specified for containers within a Deployment. This helps in resource management and allocation.

67
Q

What is the difference between a ReplicaSet and a Deployment in Kubernetes?

A

A ReplicaSet is a lower-level resource that ensures a specified number of Pod replicas are running. A Deployment, on the other hand, provides higher-level abstractions for managing replica Pods, including rolling updates and rollbacks.

68
Q

What is a Kubernetes Service?

A

A Kubernetes Service is an abstract way to expose an application running on a set of Pods as a network service. It provides a consistent endpoint for accessing the Pods, even as they come and go.

69
Q

What are the two primary types of Kubernetes Services?

A

The two primary types of Kubernetes Services are ClusterIP and NodePort. ClusterIP exposes the service on an internal cluster IP, while NodePort exposes it on a port across all nodes.

70
Q

How does a LoadBalancer Service differ from a NodePort Service in Kubernetes?

A

A LoadBalancer Service automatically provisions an external load balancer (e.g., on cloud providers) to distribute traffic to the Pods. A NodePort Service exposes the service on a port on every node in the cluster.

71
Q

What is the purpose of an Ingress Controller in Kubernetes?

A

An Ingress Controller manages external access to services within the cluster. It allows you to define routing rules and expose services over HTTP and HTTPS.

72
Q

How do you expose a Kubernetes Service within the cluster without external access?

A

You can expose a Kubernetes Service within the cluster without external access by using the ClusterIP type. It provides an internal cluster IP for accessing the service.

73
Q

What is the purpose of ConfigMaps in Kubernetes?

A

ConfigMaps are used to decouple configuration data from Pods. They allow you to store configuration settings as key-value pairs and mount them as environment variables or files.

74
Q

How can you create a ConfigMap in Kubernetes?

A

You can create a ConfigMap in Kubernetes by defining it in a YAML file or by using the kubectl create configmap command with key-value pairs.

75
Q

What are Secrets in Kubernetes, and when are they used?

A

Secrets in Kubernetes are used to store sensitive information like passwords, tokens, or keys. They are encoded and can be mounted as files or used as environment variables in Pods.

76
Q

How do you create a Secret in Kubernetes?

A

You can create a Secret in Kubernetes by defining it in a YAML file or by using the kubectl create secret command with the sensitive data.

77
Q

What are Persistent Volumes (PVs) in Kubernetes?

A

Persistent Volumes (PVs) are storage resources in a Kubernetes cluster that exist independently of Pods. They can be dynamically provisioned or pre-allocated.

78
Q

What is a Persistent Volume Claim (PVC) in Kubernetes, and why is it used?

A

A Persistent Volume Claim (PVC) is a request for storage by a user or a Pod. It is used to bind to a Persistent Volume (PV) and provide storage to the Pod.

79
Q

How does Kubernetes ensure data persistence with Persistent Volumes and Persistent Volume Claims?

A

Kubernetes ensures data persistence by binding a PVC to a suitable PV. Even if a Pod is rescheduled or recreated, it can claim the same PV, preserving its data.