Skip to main content
Glama

secret_create

Generate and manage Kubernetes Secrets in a specified namespace using key-value pairs, with automatic base64 encoding. Simplify secure data handling across multiple clusters.

Instructions

Create a Secret in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Secret name data: A dictionary of key-value pairs (values will be base64 encoded) secret_type: The type of the Secret (default is "Opaque")

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
dataYes
nameYes
namespaceYes
secret_typeNoOpaque

Implementation Reference

  • The main handler function for the 'secret_create' MCP tool. It creates a Kubernetes Secret using the provided parameters, encodes data in base64, and uses the Kubernetes CoreV1 API.
    @mcp.tool() @use_current_context @check_readonly_permission def secret_create(context_name: str, namespace: str, name: str, data: dict, secret_type: str = "Opaque"): """ Create a Secret in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Secret name data: A dictionary of key-value pairs (values will be base64 encoded) secret_type: The type of the Secret (default is "Opaque") Returns: Status of the creation operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] encoded_data = {key: base64.b64encode(value.encode()).decode() for key, value in data.items()} secret = V1Secret( metadata=V1ObjectMeta(name=name), data=encoded_data, type=secret_type ) created_secret = core_v1.create_namespaced_secret(namespace=namespace, body=secret) return {"name": created_secret.metadata.name, "status": "Created"}

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bourbonkk/k8s-pilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server