inferwire
/
AI·5 min read

Cluster Context Lifts LLM Kubernetes Patches From 11.1% to 78%

A Dynatrace Research study gave four LLMs live service-call data before asking them to fix Kubernetes misconfigurations. Correct patches for dependency-bound findings rose from 11.1 to 78.0 percent.

TL;DR

  • A Dynatrace Research study found LLM patches for dependency-bound Kubernetes findings were correct 78.0 percent of the time with live cluster context, 11.1 percent without [^1].
  • Without that context, models wrote scanner-compliant fixes that break service dependencies, such as invented Secret names or policies that cut observed traffic [^1].

Background

Kubernetes runs containerized applications across a cluster of machines, and one configuration surface controls how workloads reach each other, which privileges they hold and what data they may read [^1]. Kubernetes Security Posture Management (KSPM) scanners flag risky settings in that configuration. According to the paper, LLM-based tools already generate fixes from such findings, but they prompt the model with each finding in isolation, assuming general hardening knowledge is enough [^1].

What happened

Farooq Shaikh of Dynatrace Research in Linz built KuTIE, short for Kubernetes Topology Intelligence Engine [^1]. It collects live service-call edges from the Istio service mesh and scanner findings from the Trivy Operator, and adds them to the remediation prompt: which services call the workload and which it calls, which ports it binds, and which Secrets and ConfigMaps its service account is allowed to read [^1]. Each patch is validated with a server-side dry run in kubectl. Depending on its expected effect on running services, which the paper calls functional blast radius, KuTIE applies it or flags it for human review. The evaluation measures only the added prompt context, not this gate [^1].

To test it, Shaikh built VulnCare, a deliberately misconfigured healthcare cluster with 36 deployments in four namespaces and 51 observed call edges [^1]. It has 31 injectable findings in seven classes, from Linux capabilities and network policies to RBAC and storage. Of these, 25 are topology-dependent: a correct fix needs a value that is only visible in the running cluster. The other 6 are controls that can be fixed from the finding text alone [^1]. Four models, Claude Sonnet 4.6, Claude Haiku 4.5, Llama 4 Maverick and Mistral Large, got every finding once with and once without the cluster context, for 248 trials [^1]. A patch counted as correct only if it cleared the finding and carried the exact value that keeps the dependency intact. The cluster and the evaluation code are released as open source [^1].

With context, 78 of 100 topology-dependent patches were correct, against 11 of 99 without; one blind trial produced malformed JSON and was excluded [^1]. The gap held for every model, from 0.59 for Llama 4 Maverick to 0.76 for Claude Sonnet 4.6, which got 22 of 25 right with context and 3 without [^1]. For credential and network-policy findings, no model produced a single correct patch without context, while 19 of 20 were correct in each class with it [^1]. On the six topology-independent findings, both conditions scored 23 of 24, which the paper takes as confirmation that the gain doesn't come from a longer prompt [^1].

Why it matters

The failures without context weren't malformed output. In 88 of 99 blind trials, the model wrote a standard hardening patch that satisfied the scanner but left out the cluster-specific value: an invented Secret name or key, a default-deny network policy that severs an observed call, a "drop: ALL" capability setting on a service that has to bind a port, or a default StorageClass [^1]. According to the paper, dropping a required capability keeps a service from becoming ready so its callers lose the dependency, and naming the wrong Secret stops the container from starting even though the scanner finding clears [^1]. For teams that let an LLM propose fixes from scanner output alone, the risk the study describes is a clean scan followed by a broken service.

Context didn't solve everything. With it, 22 patches still failed, mostly in RBAC (10 of 16), policy (3 of 8) and storage (3 of 8). The paper attributes these to transcription: models narrowed or paraphrased a value they had been given instead of copying it [^1]. In the policy class, the supplied image digest led three of four models to repoint an image and sever two call edges, so correctness there fell from 8 of 8 to 5 of 8 with context [^1]. The paper also names its limits: one healthcare cluster and four models, a mix of findings chosen by construction, and call edges collected over a finite window, so a rarely used path can be missing and produce exactly the destructive patch the approach is meant to prevent. How often topology-dependent findings occur in production is not established [^1].

Practical example

Say your scanner flags a payments service because it keeps a database password in a plaintext environment variable, and you ask an LLM for a fix. Given only the finding and the deployment spec, the model will likely point the service to a Secret with a plausible name. In the study, invented Secret names or keys were a recurring failure in exactly this class [^1]. If no such Secret exists, the container won't start, although the scan now passes [^1]. If you also pass the name and key of the Secret the service account already reads, as KuTIE does, the model has the value it needs to copy. In this class, correct patches rose from 1 of 20 to 17 of 20 [^1]. You still run the dry run and check that the service comes up.

Related gear

We recommend this book because it covers how Kubernetes clusters are attacked and how to harden their configuration, the kind of settings the patches in this study change.

AdvertisementAmazon

Hacking Kubernetes: Threat-Driven Analysis and Defense

Sources

  1. [1]arXiv — Does Runtime Topology Context Improve LLM-Generated Kubernetes Security Patches?