Skip to main content
Glama

secret_create

Create Kubernetes Secrets to store sensitive data like passwords and API keys in a specified namespace, with automatic base64 encoding of values.

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
namespaceYes
nameYes
dataYes
secret_typeNoOpaque

Implementation Reference

  • The main handler function for the 'secret_create' tool. It is decorated with @mcp.tool() which likely registers it as an MCP tool. The function creates a Kubernetes Secret in the specified namespace by encoding the provided data as base64 and using the Kubernetes CoreV1Api.
    @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"}
  • tools/secret.py:28-28 (registration)
    The @mcp.tool() decorator registers the secret_create function as an MCP tool.
    @mcp.tool()

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