DaemonSets: The Philosopher’s Stone of Lazy Sysadmins

LobuhiSec
3 min readFeb 14, 2024
Me on twitter, waiting for hate

In the complex and ever-evolving landscape of system administration, Kubernetes DaemonSets have emerged as a seemingly magical solution, akin to the mythical Philosopher’s Stone, for deploying and managing containerized applications across a cluster of machines. However, as with any powerful tool, there is a dark side to its use, particularly when it comes to security implications of deploying privileged and non-isolated workloads, such as Prometheus, for monitoring purposes. This article delves into the risks associated with such practices and argues for a more traditional approach to deploying monitoring tools.

The Allure of DaemonSets

DaemonSets, a feature of Kubernetes, allow sysadmins to automatically deploy and run a copy of a pod on every node in a cluster. This functionality is especially useful for deploying system-level services, such as log collectors or monitoring agents, which need to run on every node. The convenience and efficiency of DaemonSets are undeniable, offering sysadmins a “lazy” way to ensure widespread service deployment with minimal effort.

The Security Conundrum

The problem arises when DaemonSets are used to deploy privileged and non-isolated workloads. Tools like Prometheus, widely used for monitoring Kubernetes clusters, often require access to the underlying host to retrieve data. When such tools are deployed using DaemonSets with elevated privileges and without proper isolation, it significantly increases the complexity of the cluster and expands the attack surface.

Privileged pods have access to host-level resources, bypassing the security mechanisms of the container runtime and Kubernetes itself. This creates a potential entry point for attackers, who, upon compromising a single pod, could escalate their privileges and gain control over the entire cluster. The deployment of non-isolated workloads further exacerbates this issue, as it allows for potential lateral movement within the cluster, giving attackers the opportunity to exploit vulnerabilities in one part of the system to compromise other parts.

The Case for Host-Level Monitoring

Despite the widespread industry practice of deploying monitoring tools within Kubernetes clusters, there is a strong argument to be made for installing such tools at the host level. Host-level monitoring tools should operate outside the Kubernetes cluster, reducing the risk of them being compromised through cluster-level vulnerabilities. This approach not only minimizes the attack surface of the cluster but also ensures that monitoring capabilities remain intact even if the cluster itself is compromised. Of course, we would lose the capabilities that Kubernetes offers us in restarting failed workloads, but solutions can be found to implement this at the node level as well.

Moreover, host-level monitoring tools can offer more comprehensive visibility into system-level metrics and logs, which are crucial for detecting and responding to security incidents. By operating at the host level, these tools are less susceptible to the limitations and vulnerabilities associated with containerized environments.

Conclusion

While DaemonSets offer a convenient and efficient means of deploying services across a Kubernetes cluster, the security implications of using them to deploy privileged and non-isolated workloads cannot be overlooked. The expansion of the attack surface and the increased complexity of the cluster’s security posture demand a reconsideration of such practices. In the realm of monitoring, particularly, the traditional approach of installing tools at the host level presents a more secure and effective alternative. As tempting as it may be to reach for the Philosopher’s Stone of DaemonSets, sysadmins must weigh the convenience against the potential risks and consider the broader implications for their cluster’s security.

--

--