Skip to main content
Glama

clusterrole_create

Create a ClusterRole in Kubernetes by specifying the context name, role name, and policy rules. Simplifies role management across clusters via the k8s-pilot MCP server.

Instructions

Create a ClusterRole in the cluster.

Args: context_name: The Kubernetes context name name: The ClusterRole name rules: List of policy rules

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
nameYes
rulesYes

Implementation Reference

  • The main handler function that creates a Kubernetes ClusterRole using the RBAC API, given context_name, name, and rules.
    def clusterrole_create(context_name: str, name: str, rules: list): """ Create a ClusterRole in the cluster. Args: context_name: The Kubernetes context name name: The ClusterRole name rules: List of policy rules Returns: Status of the creation operation """ rbac_v1: RbacAuthorizationV1Api = get_api_clients(context_name)["rbac"] clusterrole = V1ClusterRole( metadata=V1ObjectMeta(name=name), rules=[V1PolicyRule(**rule) for rule in rules] ) created_clusterrole = rbac_v1.create_cluster_role(body=clusterrole) return {"name": created_clusterrole.metadata.name, "status": "Created"}
  • tools/role.py:112-112 (registration)
    Registers the clusterrole_create tool using the @mcp.tool() decorator.
    @mcp.tool()

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