Skip to main content
Glama

ingress_create

Create Kubernetes Ingress resources to route external traffic to backend services in specified namespaces.

Instructions

Create an Ingress in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Ingress name host: The host for the Ingress service_name: The backend service name service_port: The backend service port

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
hostYes
service_nameYes
service_portYes

Implementation Reference

  • The handler function for the 'ingress_create' MCP tool. It creates a Kubernetes Ingress resource in the specified namespace with the given host, service, and port using the Kubernetes NetworkingV1 API.
    def ingress_create(context_name: str, namespace: str, name: str, host: str, service_name: str, service_port: int):
        """
        Create an Ingress in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The Ingress name
            host: The host for the Ingress
            service_name: The backend service name
            service_port: The backend service port
    
        Returns:
            Status of the creation operation
        """
        networking_v1: NetworkingV1Api = get_api_clients(context_name)["networking"]
        ingress = V1Ingress(
            metadata=V1ObjectMeta(name=name),
            spec=V1IngressSpec(
                rules=[
                    V1IngressRule(
                        host=host,
                        http=V1HTTPIngressRuleValue(
                            paths=[
                                V1HTTPIngressPath(
                                    path="/",
                                    path_type="Prefix",
                                    backend=V1IngressBackend(
                                        service={"name": service_name, "port": {"number": service_port}}
                                    )
                                )
                            ]
                        )
                    )
                ]
            )
        )
        created_ingress = networking_v1.create_namespaced_ingress(namespace=namespace, body=ingress)
        return {"name": created_ingress.metadata.name, "status": "Created"}
  • tools/ingress.py:28-28 (registration)
    The @mcp.tool() decorator registers the ingress_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