|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// *mcp_gateway_config/mcp-gateway-troubleshooting.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="proc-mcp-gateway-ts-requests-fail-or-bypass-router_{context}"] |
| 7 | += Troubleshooting requests failing or bypassing the router |
| 8 | + |
| 9 | +[role="_abstract"] |
| 10 | +When you are certain that an `MCPGatewayExtension` custom resource (CR) exists for your MCP server, but requests either fail or bypass the router, it might mean that the `EnvoyFilter` CR is not applied properly. You can take several steps to troubleshoot the problem. |
| 11 | + |
| 12 | +The `EnvoyFilter` CR is automatically created in the `Gateway` CR namespace by the MCP gateway controller component when an `MCPGatewayExtension` CR is `Ready`. |
| 13 | + |
| 14 | +[IMPORTANT] |
| 15 | +==== |
| 16 | +You can look closely at the `EnvoyFilter` CR during deep troubleshooting, but do not manually edit or delete the CR. |
| 17 | +==== |
| 18 | + |
| 19 | +.Prerequisites |
| 20 | + |
| 21 | +* You installed {mcpg}. |
| 22 | +* You installed the {oc-first}. |
| 23 | +* You configured a `Gateway` object. |
| 24 | +* You configured an `HTTPRoute` object for the gateway. |
| 25 | +* You registered an MCP server. |
| 26 | +
|
| 27 | +.Procedure |
| 28 | + |
| 29 | +. Ensure that the `Gateway` object exists and is in the expected namespace by checking the general `Gateway` object configuration by running the following command: |
| 30 | ++ |
| 31 | +[source,terminal] |
| 32 | +---- |
| 33 | +$ oc get gateway -A |
| 34 | +---- |
| 35 | ++ |
| 36 | +This command returns general information about all `Gateway` objects in the cluster. If the `Gateway` object you are troubleshooting exists, the command returns the `gatewayClassName` is it using, whether or not it has an IP address or hostname assigned, and a `status`, such as `Ready`, `Programmed`, or `Pending`. |
| 37 | + |
| 38 | +. Verify that the `MCPGatewayExtension` CR is `Ready` by running the following command: |
| 39 | ++ |
| 40 | +[source,terminal] |
| 41 | +---- |
| 42 | +$ oc get mcpgatewayextension -A |
| 43 | +---- |
| 44 | + |
| 45 | +. Verify that a `ReferenceGrant` CR exists if the `MCPGatewayExtension` CR is in a different namespace than the `Gateway` object by running the following command: |
| 46 | ++ |
| 47 | +[source,terminal,subs="+quotes"] |
| 48 | +---- |
| 49 | +$ oc get referencegrant _<referencegrant_name>_ -n _<gateway_system>_ -o yaml |
| 50 | +---- |
| 51 | ++ |
| 52 | +* Replace `_<referencegrant_name>_` with the names of the `ReferenceGrant` CR. |
| 53 | +* Replace `_<gateway_system>_` with the namespace where the `Gateway` object is applied. |
| 54 | +
|
| 55 | +. Check the `HTTPRoute` CR by running the following command: |
| 56 | ++ |
| 57 | +[source,terminal,subs="+quotes"] |
| 58 | +---- |
| 59 | +$ oc describe httproute _<httproute_name>_ -n _<httproute_namespace>_ |
| 60 | +---- |
| 61 | ++ |
| 62 | +* Replace `_<httproute_namespace>_` with the namespace where the `HTTPRoute` CR is applied. |
| 63 | +* Replace `_<httproute_name>_` with the names of the `HTTPRoute` CR. |
| 64 | +* If the `HTTPRoute` CR is not `Accepted` by the `Gateway` object, the route is not programmed into Envoy, causing a `404`. |
| 65 | +* The conditions `Status.Parents.Conditions: Accepted: True` and `Programmed: True` show that the route is correct. |
| 66 | +
|
| 67 | +. If any of the CRs you just checked are not `Ready`, check the controller logs for `EnvoyFilter` creation errors by running the following command: |
| 68 | ++ |
| 69 | +[source,terminal,subs="+quotes"] |
| 70 | +---- |
| 71 | +$ oc logs -n _<mcp_system>_ deployment/mcp-gateway-controller |
| 72 | +---- |
| 73 | ++ |
| 74 | +* Replace `_<mcp_system>_` with the name of your MCP gateway deployment. |
| 75 | +* This step verifies that the MCP controller is successfully generating the underlying Istio configurations. |
| 76 | +
|
| 77 | +. Check that the `EnvoyFilter` exists in the `Gateway` namespace by running the following command: |
| 78 | ++ |
| 79 | +[source,terminal,subs="+quotes"] |
| 80 | +---- |
| 81 | +$ oc get envoyfilter -n _<gateway_namespace>_ -l app.kubernetes.io/managed-by=mcp-gateway-controller |
| 82 | +---- |
| 83 | ++ |
| 84 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 85 | +
|
| 86 | +. Verify the `EnvoyFilter` configuration by running the following command: |
| 87 | ++ |
| 88 | +[source,terminal,subs="+quotes"] |
| 89 | +---- |
| 90 | +$ oc describe envoyfilter -n _<gateway_namespace>_ -l app.kubernetes.io/managed-by=mcp-gateway-controller |
| 91 | +---- |
| 92 | ++ |
| 93 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 94 | +* The `workloadSelector` labels must match your `Gateway` pods, or your policies are bypassed. |
| 95 | +
|
| 96 | +. Compare the `EnvoyFilter` labels against your pod labels by running the following command: |
| 97 | ++ |
| 98 | +[source,terminal,subs="+quotes"] |
| 99 | +---- |
| 100 | +$ oc get pods -n _<gateway_namespace>_ --show-labels |
| 101 | +---- |
| 102 | ++ |
| 103 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 104 | +
|
| 105 | +. Identify the port that the `Gateway` object is configured to use by running the following command: |
| 106 | ++ |
| 107 | +[source,terminal,subs="+quotes"] |
| 108 | +---- |
| 109 | +$ oc get gateway _<gateway_name>_ -n _<gateway_namespace>_ -o jsonpath='{range .spec.listeners[*]}{.name}{": "}{.port}{"\n"}{end}' |
| 110 | +---- |
| 111 | ++ |
| 112 | +* Replace `_<gateway_name>_` with the name of the `Gateway` object. |
| 113 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 114 | +
|
| 115 | +. Verify the `EnvoyFilter` chain binding by running the following command: |
| 116 | ++ |
| 117 | +[source,terminal,subs="+quotes"] |
| 118 | +---- |
| 119 | +$ oc exec -n _<gateway_namespace>_ deploy/_<gateway_name>_-istio -- curl -s localhost:15000/config_dump | jq '.configs[] | select(.["@type"] | contains("ListenersConfigDump")) | .dynamic_listeners[0.0.0.0_8080] | select(.name | contains("_<gateway_port>_"))' |
| 120 | +---- |
| 121 | ++ |
| 122 | +* Replace `_<gateway_name>_` with the name of the `Gateway` object. |
| 123 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 124 | +* Replace `_<gateway_port>_` with the port your Gateway object is configured to use. |
| 125 | +* Check for `envoy.filters.http.ext_proc`. |
| 126 | +
|
| 127 | +. Check the Istio gateway pod configuration by running the following command: |
| 128 | ++ |
| 129 | +[source,terminal,subs="+quotes"] |
| 130 | +---- |
| 131 | +$ oc exec -n _<gateway_namespace>_ deploy/_<gateway_name>_-istio -- curl localhost:15000/config_dump | grep ext_proc |
| 132 | +---- |
| 133 | ++ |
| 134 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 135 | +* Replace `_<gateway_name>_` with the names of the `Gateway` object. |
| 136 | +* If this command returns empty, the `EnvoyFilter` CR is not active on this pod. Traffic is bypassing your policies. |
| 137 | +
|
| 138 | +. Restart the Istio gateway to force a configuration reload by running the following command: |
| 139 | ++ |
| 140 | +[source,terminal,subs="+quotes"] |
| 141 | +---- |
| 142 | +$ oc rollout restart deployment/_<gateway_name>_-istio -n _<gateway_namespace>_ |
| 143 | +---- |
| 144 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 145 | +* Replace `_<gateway_name>_` with the names of the `Gateway` object. |
0 commit comments