Basic -- Kubernetes:
What is Kubernetes?
-
Answer: Kubernetes is an open-source container orchestration platform that automates deploying, scaling, and managing containerized applications. It provides tools for managing microservices, load balancing, automated scaling, and self-healing in production environments.
What are the main components of Kubernetes?
-
Answer: Kubernetes consists of the following main components:
-
Master Node: Controls the Kubernetes cluster, running the API server, scheduler, and controller manager.
-
Worker Nodes: Hosts the containers (pods), including the container runtime (like Docker), kubelet, and kube-proxy.
-
API Server: Exposes the Kubernetes API, which is the entry point for interactions with the cluster.
-
Scheduler: Assigns workloads (pods) to nodes based on resource availability.
-
Controller Manager: Ensures the desired state of the cluster (e.g., ensures that the number of pods running is the same as desired).
-
Etcd: A distributed key-value store that holds cluster configuration and state data.
-
Kubelet: Ensures that containers are running in a pod on the worker nodes.
-
Kube-proxy: Maintains network rules for pod communication within the cluster.
What is a Pod in Kubernetes?
-
Ans
What is a Deployment in Kubernetes?
-
Answer: A Deployment is a Kubernetes resource used to manage stateless applications. It defines the desired state of a set of pods, ensuring that the correct number of replicas is running. Deployments handle updates, rollbacks, and scaling of the applications.
How does Kubernetes handle scaling?
-
Answer: Kubernetes offers both manual and automatic scaling:
-
Horizontal Pod Autoscaler (HPA): Automatically scales the number of pods based on CPU or memory usage or custom metrics.
-
Vertical Pod Autoscaler (VPA): Automatically adjusts the CPU and memory requests for individual pods.
-
Cluster Autoscaler: Adds or removes nodes to the cluster based on resource usage.
What is a Service in Kubernetes?
-
Answer: A Service is an abstraction that defines a logical set of Pods and a policy for accessing them. Kubernetes Services allow Pods to communicate with each other and expose applications to external traffic. Types of Services:
-
ClusterIP (default): Exposes the service within the cluster.
-
NodePort: Exposes the service on a static port on each node's IP.
-
LoadBalancer: Exposes the service externally via a cloud provider's load balancer.
-
ExternalName: Maps the service to a DNS name outside the cluster.
What is the difference between a ReplicaSet and a Deployment?
-
Answer: A ReplicaSet ensures that a specified number of pod replicas are running at any given time. A Deployment is a higher-level abstraction that manages ReplicaSets, providing additional features like rolling updates, rollbacks, and more. In most cases, you use Deployments instead of ReplicaSets directly.
What is a Namespace in Kubernetes?
-
Answer: A Namespace is a way to divide cluster resources between multiple users or applications. Namespaces provide isolation, enabling multiple teams to share the same cluster without interfering with each other’s resources. You can define resource quotas, access controls, and policies for each namespace.
What is Helm in Kubernetes?
-
Answer: Helm is a package manager for Kubernetes, allowing you to define, install, and manage Kubernetes applications using charts. A Helm chart is a collection of files that describe a set of Kubernetes resources. It simplifies the deployment of complex applications and makes them repeatable.
What is the difference between StatefulSet and Deployment?
-
Answer:
-
StatefulSet is used for managing stateful applications that require stable, unique network identifiers and persistent storage.
-
Deployment is for stateless applications where pods can be replaced freely and do not need stable identities or persistent storage.
What is a ConfigMap and a Secret in Kubernetes?
-
Answer:
-
ConfigMap: Stores non-sensitive configuration data as key-value pairs that can be accessed by Pods. It is suitable for application settings that are not sensitive.
Exactly! A ConfigMap in Kubernetes is used to store non-sensitive configuration data that can be referenced by applications running in Pods. It helps decouple configuration from application code, allowing you to change configurations without modifying the actual application itself.
Key Features of ConfigMap:
-
Key-Value Pairs: ConfigMaps store data as simple key-value pairs. The keys are typically configuration options, and the values can be anything from application settings, environment variables, or file content.
-
Decoupling Configuration: By using ConfigMaps, you can keep configuration separate from your application code. This makes it easier to modify configurations without needing to rebuild or redeploy your application.
-
Accessing ConfigMaps: Pods can access the data stored in ConfigMaps in various ways:
-
As environment variables within the container.
-
Mounted as files inside the container (this is useful for configuration files).
-
As command-line arguments when starting the container.
-
-
Not for Sensitive Data: Since ConfigMaps store plain-text configuration, they are not meant for sensitive data like passwords or tokens. For sensitive data, Kubernetes has a separate resource called Secrets.
-
Secret: Stores sensitive data such as passwords, tokens, and certificates, which are encrypted and made available to pods securely.
What is a DaemonSet in Kubernetes?
-
Answer: A DaemonSet ensures that a specific pod is running on every node in the cluster (or on selected nodes, based on labels). It is commonly used for logging, monitoring agents, or network proxies that need to run on every node.
What is ETCD ?
Comments
Post a Comment