|
| 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's 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` during deep troubleshooting, but do not manually edit or delete the CR. |
| 17 | +==== |
| 18 | + |
| 19 | +.Prerequisites |
| 20 | + |
| 21 | +* You installed {mcpg}. |
| 22 | +* You installed {prodname}. |
| 23 | +* You configured a `Gateway` object. |
| 24 | +* You configured an `HTTPRoute` object for the gateway. |
| 25 | +* You installed the {oc-first}. |
| 26 | +* You registered an MCP server. |
| 27 | +
|
| 28 | +.Procedure |
| 29 | + |
| 30 | +. Ensure that the `Gateway` object exists and is in the expected namespace by checking the general `Gateway` object configuration by using the following command: |
| 31 | ++ |
| 32 | +[source,terminal] |
| 33 | +---- |
| 34 | +$ oc get gateway -A |
| 35 | +---- |
| 36 | ++ |
| 37 | +This command returns general information about all `Gateway` objects in the cluster. If the `Gateway` object you are troubleshooting does exist, 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`. |
| 38 | + |
| 39 | +. Verify that the `MCPGatewayExtension` CR is `Ready` by running the following command: |
| 40 | ++ |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +$ oc get mcpgatewayextension -A` |
| 44 | +---- |
| 45 | + |
| 46 | +. Verify that a `ReferenceGrant` CR exists if the `MCPGatewayExtension` CR is in a different namespace than the `Gateway` object by running the following command: |
| 47 | ++ |
| 48 | +[source,terminal,subs="+quotes"] |
| 49 | +---- |
| 50 | +$ oc get referencegrant _<referencegrant_name>_ -n _<referencegrant_namespace>_ -o yaml |
| 51 | +---- |
| 52 | ++ |
| 53 | +* Replace `_<referencegrant_namespace>_` with the namespace where the `ReferenceGrant` CR is applied. |
| 54 | +* Replace `_<referencegrant_name>_` with the names of the `ReferenceGrant` CR. |
| 55 | +
|
| 56 | +. Check the `HTTPRoute` CR by running the following command: |
| 57 | ++ |
| 58 | +[source,terminal,subs="+quotes"] |
| 59 | +---- |
| 60 | +$ oc describe httproute _<httproute_name>_ -n _<httproute_namespace>_ |
| 61 | +---- |
| 62 | ++ |
| 63 | +* Replace `_<httproute_namespace>_` with the namespace where the `HTTPRoute` CR is applied. |
| 64 | +* Replace `_<httproute_name>_` with the names of the `HTTPRoute` CR. |
| 65 | +* If the `HTTPRoute` CR is not `Accepted` by the `Gateway` object, the route is not programmed into Envoy, causing a `404`. |
| 66 | +* The conditions `Status.Parents.Conditions: Accepted: True` and `Programmed: True` show that the route is correct. |
| 67 | +
|
| 68 | +. If any of the CRs you just checked are not `Ready`, check the controller logs for `EnvoyFilter` creation errors by running the following command: |
| 69 | ++ |
| 70 | +[source,terminal,subs="+quotes"] |
| 71 | +---- |
| 72 | +$ oc logs -n _<mcp_system>_ deployment/mcp-gateway-controller |
| 73 | +---- |
| 74 | ++ |
| 75 | +* Replace `_<mcp_system>_` with the name of your MCP gateway deployment. |
| 76 | +* This step verifies that the MCP controller is successfully generating the underlying Istio configurations. |
| 77 | +
|
| 78 | +. Check that the `EnvoyFilter` exists in the `Gateway` namespace by running the following command: |
| 79 | ++ |
| 80 | +[source,terminal,subs="+quotes"] |
| 81 | +---- |
| 82 | +$ oc get envoyfilter -n _<gateway_namespace>_ -l app.kubernetes.io/managed-by=mcp-gateway-controller |
| 83 | +---- |
| 84 | ++ |
| 85 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 86 | +
|
| 87 | +. Verify the `EnvoyFilter` configuration by running the following command: |
| 88 | ++ |
| 89 | +[source,terminal,subs="+quotes"] |
| 90 | +---- |
| 91 | +$ oc describe envoyfilter -n _<gateway_namespace>_ -l app.kubernetes.io/managed-by=mcp-gateway-controller |
| 92 | +---- |
| 93 | ++ |
| 94 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 95 | +* The `workloadSelector` labels must match your `Gateway` pods, or your policies are bypassed. |
| 96 | +
|
| 97 | +. Compare the `EnvoyFilter` labels against your pod labels by running the following command: |
| 98 | ++ |
| 99 | +[source,terminal,subs="+quotes"] |
| 100 | +---- |
| 101 | +$ oc get pods -n _<gateway_namespace>_ --show-labels |
| 102 | +---- |
| 103 | ++ |
| 104 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 105 | +
|
| 106 | +. Identify the port that the `Gateway` object is configured to use by running the following command: |
| 107 | ++ |
| 108 | +[source,terminal,subs="+quotes"] |
| 109 | +---- |
| 110 | +$ oc get gateway <gateway_name> -n _<gateway_namespace>_ -o jsonpath='{range .spec.listeners[*]}{.name}{": "}{.port}{"\n"}{end}' |
| 111 | +---- |
| 112 | ++ |
| 113 | +* Replace `_<gateway_name>_` with the name of the `Gateway` object. |
| 114 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 115 | +
|
| 116 | +. Confirm that Envoy opened the `Gateway`-specified port by running the following command: |
| 117 | ++ |
| 118 | +[source,terminal,subs="+quotes"] |
| 119 | +---- |
| 120 | +$ oc exec -n <gateway_namespace> deploy/<gateway_name>-istio -- curl -s localhost:15000/listeners | grep -E ":[0-9]+" |
| 121 | +---- |
| 122 | + |
| 123 | +. Verify the `EnvoyFilter` chain binding by running the following command: |
| 124 | ++ |
| 125 | +[source,terminal,subs="+quotes"] |
| 126 | +---- |
| 127 | +$ oc exec -n _<gateway_namespace>_ deploy/_<gateway_name>_-istio -- curl -s localhost:15000/config_dump | jq '.configs[] | select(.["@type"] | contains("ListenersConfigDump")) | .dynamic_listeners[] | select(.name | contains(":<PORT_FROM_STEP_6>"))' |
| 128 | +---- |
| 129 | ++ |
| 130 | +* Replace `_<gateway_name>_` with the name of the `Gateway` object. |
| 131 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 132 | +* Check for `envoy.filters.http.ext_authz` for Authorino or `envoy.filters.http.ratelimit` for Limitador within the specific port config. |
| 133 | +
|
| 134 | +. Check the Istio gateway pod configuration by running the following command: |
| 135 | ++ |
| 136 | +[source,terminal,subs="+quotes"] |
| 137 | +---- |
| 138 | +$ oc exec -n _<gateway_namespace>_ deploy/_<gateway_name>_-istio -- curl localhost:15000/config_dump | grep ext_proc |
| 139 | +---- |
| 140 | ++ |
| 141 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 142 | +* Replace `_<gateway_name>_` with the names of the `Gateway` object. |
| 143 | +* If this command returns empty, the `EnvoyFilter` CR is not active on this pod. Traffic is bypassing your policies. |
| 144 | +
|
| 145 | +. Restart the Istio gateway to force a configuration reload by running the following command: |
| 146 | ++ |
| 147 | +[source,terminal,subs="+quotes"] |
| 148 | +---- |
| 149 | +$ oc rollout restart deployment/_<gateway_name>_-istio -n _<gateway_namespace>_` |
| 150 | +---- |
| 151 | +* Replace `_<gateway_namespace>_` with the namespace where the `Gateway` object is applied. |
| 152 | +* Replace `_<gateway_name>_` with the names of the `Gateway` object. |
0 commit comments