ingress_create
Create and manage Kubernetes Ingress resources in specified namespaces with context-aware configuration, enabling traffic routing to backend services via host and port settings.
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 | ||
| host | Yes | ||
| name | Yes | ||
| namespace | Yes | ||
| service_name | Yes | ||
| service_port | Yes |
Implementation Reference
- tools/ingress.py:28-70 (handler)The main handler function for the 'ingress_create' MCP tool. It creates a Kubernetes Ingress resource with the specified host, service, and port, decorated with @mcp.tool() for registration, @use_current_context for context management, and @check_readonly_permission for permissions.@mcp.tool() @use_current_context @check_readonly_permission 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()
- tools/ingress.py:31-45 (schema)Function signature with type hints and docstring defining input parameters and output for the ingress_create tool schema.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 """