Câu hỏi phỏng vấn Kubernetes
Câu hỏi

What is a DaemonSet?

Câu trả lời

A DaemonSet is a Kubernetes controller that ensures a specific pod runs on all (or a subset of) nodes within a cluster. This is particularly useful for deploying background services that need to be present on every node, such as log collection agents, monitoring tools, or network plugins.

Key Characteristics of DaemonSets:

  1. Uniform Deployment: DaemonSets ensure that a pod is deployed on every node in the cluster. When a new node is added, the DaemonSet automatically schedules the pod on the new node. Conversely, when a node is removed, the pod is also removed.
  2. Use Cases: Common use cases include:
    • Log Collection: Running log collectors like Fluentd or Logstash on every node to centralize logging data.
    • Monitoring: Deploying monitoring agents such as Prometheus Node Exporter to collect node-level metrics.
    • Security: Running security agents or compliance tools on every node.
    • Network Management: Ensuring network plugins or firewalls are consistently deployed across all nodes.
    • Storage Management: Managing storage plugins to provide shared storage systems across the cluster[1][3][5][6][10].

How DaemonSets Work:

  • Pod Scheduling: DaemonSets use a reconciliation loop to ensure the desired state of pods on nodes. The DaemonSet controller checks the current state of nodes and schedules the required pods if they are not already running.
  • Node Selectors: You can use node selectors to limit the nodes on which the DaemonSet pods will run, allowing for more granular control over deployment.
  • Update Strategies: DaemonSets support two update strategies:
    • RollingUpdate: Automatically deletes and recreates pods upon configuration changes.
    • OnDelete: Requires manual deletion of pods to trigger the creation of new pods with updated configurations[1][7][9].

Example YAML Configuration:

Here is a simple example of a DaemonSet configuration:

yaml Copy
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: my-daemonset
spec:
  selector:
    matchLabels:
      app: my-daemonset
  template:
    metadata:
      labels:
        app: my-daemonset
    spec:...
middle

middle

Gợi ý câu hỏi phỏng vấn

entry

What is Kubernetes? Why organizations are using it?

senior

How to rollback a Deployment?

expert

How does StatefulSets use differ from the use of "stateless" Pods with Persistent Volumes?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào