Skip to content

The Deska blog

Running Agents on Kubernetes Manifests: Safety and Speed

Learn how to use AI agents on Kubernetes manifests safely. Explore workflows for YAML validation, resource optimization, and local agent execution.

12 min read

Managing modern cloud infrastructure often requires handling hundreds of YAML files. Running agents on Kubernetes manifests has emerged as a high leverage strategy to ensure these files are valid, secure, and optimized before they ever reach a cluster. While manual linting and static analysis have been the standard, autonomous agents can now reason about resource limits, security contexts, and ingress rules by analyzing the entire context of a deployment.

The Evolution of Manifest Management

Kubernetes manifests are the declarative source of truth for your infrastructure. Traditionally, developers relied on manual reviews or rigid templates. As architectures grow, the complexity of managing ServiceAccounts, NetworkPolicies, and ResourceQuotas increases. This is where AI agents provide a bridge between intent and execution.

An agent can look at a deployment manifest and identify that a container is running as root without a clear necessity. It can then propose a SecurityContext to harden the pod. Unlike a simple linter that flags a missing field, an agent evaluates the functional impact of the configuration.

Core Workflows for AI Agents in Kubernetes

When you integrate agents into your workflow, you generally focus on three main areas: validation, transformation, and optimization.

Validation and Schema Compliance

The most basic task is ensuring that manifests adhere to the specific version of the Kubernetes API you are targeting. Agents can quickly scan files for deprecated fields or incorrect indentation, which are common causes of kubectl apply failures.

Security and Hardening

Agents are particularly effective at identifying over privileged containers. They can suggest adding readOnlyRootFilesystem: true or dropping unnecessary capabilities. By running agents on Kubernetes manifests locally, you catch these issues before they trigger a violation in your CI/CD pipeline or, worse, become a vulnerability in production.

Resource Optimization

One of the hardest parts of Kubernetes is setting appropriate resource requests and limits. If they are too low, the pod crashes. If they are too high, you waste money. Agents can analyze historical data or standard patterns for specific images (like Nginx or Postgres) to suggest sensible starting points for CPU and memory allocations.

Tools and Approaches for Agent Execution

There are several ways to run agents against your YAML files. The approach you choose depends on your privacy requirements and how much control you want over the agent context.

  • Command line interfaces (CLIs): Tools like Codex CLI or Claude Code can be run directly in your terminal to process local files.
  • Integrated Development Environments (IDEs): Plugins that offer chat interfaces within your editor.
  • Specialized Workspaces: Platforms designed to host multiple agents and tools simultaneously.

For developers who prefer a visual and organized approach, Deska offers an interesting alternative. It provides a free desktop app for Mac, Windows, and Linux where you can arrange your environment to suit your workflow.

Running Agents in a Local First Environment

The security of your infrastructure code is paramount. Sending your entire repository of Kubernetes manifests to a third party cloud service can be a concern for many organizations. This is why a local-first approach is gaining traction.

When you keep your files and sessions on your machine, you maintain full control over your intellectual property. Deska supports this by running as a local application where your data stays on your hardware. You can use your own API keys for various models, ensuring that the workspace remains a private environment.

Managing Multiple Agents Side by Side

Sometimes one agent is not enough. You might want to use Claude Code for its deep reasoning capabilities while simultaneously running another tool for quick syntax checks. In the Deska workspace, you can place panels anywhere on an infinite canvas. This allows you to see your YAML editor, a terminal running kubectl, and your AI agents all at once.

You can use the coding agents panel to trigger specific tasks. For instance, you could have one panel focused on writing a new Helm chart while another panel monitors the logs of a running pod to ensure the manifest changes are behaving as expected.

The Role of the Human in the Loop

No matter how advanced an agent is, Kubernetes remains a complex system where human judgment is required. Agents should be treated as highly capable assistants rather than autonomous administrators.

  1. Review every change: Always inspect the diffs produced by an agent before applying them to a cluster.
  2. Contextual knowledge: Agents may not know about your specific organizational constraints or legacy internal services.
  3. Gradual rollout: Apply agent generated changes to a development namespace first.

Enhancing Productivity with Ask Deska

If you are managing complex manifests across multiple directories, finding the right file can be a chore. The Ask Deska feature acts as a voice and chat assistant that can drive your workspace. You can ask it to open specific panels or find a manifest that contains a specific service name, reducing the cognitive load of navigating large projects.

For those moments when you are away from your workstation, the mobile app allows you to monitor your work. Through a secure relay that requires no exposed ports, you can check the status of your long running agent tasks or verify a deployment from your phone.

Comparison of Agent Interfaces

Interface TypePortabilityContext AwarenessSecurity Level
Standard CLIHighLowHigh (Local)
Web Based IDEMediumHighVariable
Deska WorkspaceMediumHighHigh (Local-first)

Standard CLIs are great for quick tasks but often lack the visual context of how files relate to each other. Web based IDEs offer great context but might require uploading your code to a remote server. The approach taken by Deska attempts to combine the security of local execution with the rich context of a visual workspace.

Frequently Asked Questions

How to use AI for Kubernetes YAML?

You can use AI by feeding your manifest files into an agent that understands Kubernetes schemas. The agent can then suggest improvements for security, syntax, and resource management. It is best to do this in a workspace where you can see the code and the agent output side by side.

Are AI agents safe for production Kubernetes?

Agents are safe as long as there is a human review process. You should never allow an agent to apply changes directly to a production cluster without manual approval. Using tools that run locally ensures your sensitive configuration data is not exposed to the public internet.

What is the best AI agent for DevOps?

The best agent depends on the task. Claude Code is excellent for complex reasoning, while other CLI tools might be faster for simple refactoring. The ideal setup allows you to run multiple agents side by side to compare their suggestions.

Get Started with Agentic Kubernetes Workflows

Integrating agents into your Kubernetes workflow does not have to be a massive overhaul of your current systems. By starting with local validation and security linting, you can immediately see the benefits of reduced errors and faster deployment cycles.

If you are looking for a workspace that brings all these tools together without compromising your data privacy, you can download the Deska app today. Whether you are on Mac, Windows, or Linux, you can start building your custom workspaces and running agents on your manifests in a matter of minutes.