Skip to main content

Kubernetes Tools

Category: kubernetes · 11 tools

Use this category to inspect and manage Kubernetes clusters using kubectl. These tools are designed for common DevOps and cluster maintenance tasks, including listing pods, reading logs, applying manifests, and waiting for deployments.

Tools

ToolParametersDescription
k8s.list_podsnamespace?, labels?, allNamespaces?List pods in a namespace or across the cluster
k8s.describeresource, name?, namespace?Describe a Kubernetes resource or resource instance
k8s.get_logspodName, namespace?, container?, tailLines?, since?Fetch logs from a pod
k8s.apply_manifestpath?, manifest?, namespace?Apply a manifest from a file or inline YAML
k8s.delete_resourceresource?, name?, namespace?, path?, force?Delete a resource by type/name or manifest file
k8s.list_servicesnamespace?, allNamespaces?List services in a namespace or cluster-wide
k8s.list_deploymentsnamespace?, labels?, allNamespaces?List deployments in a namespace or cluster-wide
k8s.get_config_mapname, namespace?, output?Retrieve a ConfigMap in YAML or JSON
k8s.switch_contextcontextSwitch the active kubectl context
k8s.get_namespaces-List namespaces in the current cluster context
k8s.wait_for_deploymentname, namespace?, timeout?Wait for a deployment rollout to complete

Requirements

  • kubectl must be installed and available on the PATH
  • A valid kubeconfig must be configured for the cluster you want to manage

These tools execute kubectl commands, so they depend on the host environment and cluster access.

Examples

List all pods in the current namespace

const response = await toolpack.generate({
model: 'gpt-4o',
messages: [
{ role: 'user', content: 'List all pods in the current namespace.' }
],
});

The AI may use k8s.list_pods automatically when tools are enabled.

Describe a deployment

const result = await toolpack.callTool('k8s.describe', {
resource: 'deployment',
name: 'my-app',
namespace: 'staging',
});
console.log(result);

Apply a manifest from a file

const result = await toolpack.callTool('k8s.apply_manifest', {
path: './deploy/my-app.yaml',
namespace: 'staging',
});
console.log(result);

Fetch logs from a pod

const result = await toolpack.callTool('k8s.get_logs', {
podName: 'my-app-12345',
namespace: 'staging',
tailLines: 200,
});
console.log(result);

Switch context safely

const result = await toolpack.callTool('k8s.switch_context', {
context: 'staging-cluster',
});
console.log(result);

Security and Safety

Kubernetes operations can be destructive. When using these tools with AI agents, consider restricting access with a custom mode or requiring confirmation for high-risk actions like k8s.apply_manifest and k8s.delete_resource.