GitLab Agent for Kubernetes Integration with LLMs via MCP

Terminology:

  • GitLab Agent for Kubernetes: https://docs.gitlab.com/user/clusters/agent/
  • AI agents: An artificial intelligence (AI) agent refers to a system or program that is capable of autonomously performing tasks on behalf of a user or another system. (source)

Overview

We're exploring the integration of GitLab Agent for Kubernetes (KAS / agentk) with Large Language Models (LLMs) like Claude or GitLab Duo using the Model Context Protocol (MCP). This integration would enable AI assistants to directly interact with Kubernetes clusters managed by GitLab Agent, opening up new possibilities for DevOps automation and assistance.

Current Prototype

We have developed a functional early prototype that:

  • Implements an MCP server within the Kubernetes Agent Server
  • Allows Claude to communicate with and control the GitLab Agent for Kubernetes
  • Enables direct interaction with the Kubernetes cluster through natural language

A demo video showcasing this prototype is available: https://www.youtube.com/watch?v=L1nTr06CwXY

Proposed Functionality

The integration would allow LLMs to:

  • Query cluster status and resources
  • Modify cluster resources, like creating a deployment.
  • Troubleshoot cluster issues
  • Assist with deployments and configuration

Technical Implementation

The current approach uses:

  • Model Context Protocol (MCP) as the communication layer between the LLM and KAS
  • A custom MCP server implementation within KAS
  • Authentication via already existing GitLab Agent Kubernetes API proxy authentication mechanisms, like PATs, browser session cookie, ...

Discussion Points

We'd like to gather feedback on:

  1. Use Cases: What scenarios would you find this integration most valuable?
  2. Security Considerations: What security controls should be implemented?
  3. User Experience: How should interactions between users, LLMs, and the cluster be structured?
  4. Feature Scope: What capabilities should be prioritized in the initial release?
  5. Integration Points: How should this feature integrate with other GitLab AI capabilities? Like GitLab Duo?

How should I provide feedback?

- **User Goal:** what were you trying to do? 
- **Prompt:** `YOUR_PROMPT`
- **Emoji Rating:** 👍/👎

**Outcome:** What were you expecting and what actually happened
 - What went well? 
 - What could be improved? 

<!-- Screenshot

Next Steps

  • Collect feedback on this proposal
  • Refine the prototype based on input
  • Define security and permission model
  • Create a roadmap for feature development

Related Resources

Please share your thoughts, use cases, and concerns about this potential feature. Your feedback will help shape the direction of this integration.

Edited by Timo Furrer