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
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes | ||
| name | Yes | ||
| host | Yes | ||
| service_name | Yes | ||
| service_port | Yes |
Implementation Reference
- tools/ingress.py:31-69 (handler)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()