Skip to content

Commit 3e436c1

Browse files
committed
OSDOCS-18945: adds troubleshooting MCP gateway
1 parent f19c445 commit 3e436c1

12 files changed

Lines changed: 858 additions & 1 deletion
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Module included in the following assemblies:
2+
//
3+
// *mcp_gateway_config/mcp-gateway-troubleshooting.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="con-mcp-gateway-ts-gateway-routing_{context}"]
7+
= Gateway and routing troubleshooting
8+
9+
[role="_abstract"]
10+
When traffic is not flowing after you installed {mcpg}, you can investigate each component of the gateway routing to check system health. Depending on the errors you are receiving, you can troubleshoot at several layers. Breaks can occur at the gateway, route, or policy levels.
11+
12+
If you have a `Connection Refused/Timeout` error and your client cannot reach the IP address, the cause might be the
13+
listener. In this case, one of the following situations likely applies:
14+
15+
* The port is not open.
16+
* The load balancer has not assigned an IP address.
17+
* The TLS handshake is failing.
18+
19+
When you have this type of error, check the listener first.
20+
21+
If can connect to the `Gateway `object, but you get an `HTTP` error, such as `404`, the cause can be a problem with the `HTTPRoute` custom resource (CR). The route exists, but the `Gateway` object has rejected it or the connection has failed. When you get these types of codes, check the `HTTPRoute` CR first.
22+
23+
If requests either fail with a `503` error or bypass the router, this means that the route is recognized, but the connection to the backend failed or was not authorized properly. In this case, start with API-level checks and narrow your investigation to Envoy filters as needed.
24+
25+
If the `EnvoyFilter` is not present, it usually means one of the following situations has occurred:
26+
27+
* The `Gateway` CR status is not `Programmed`.
28+
* There is a `labels` mismatch, and the MCP controller logic does not send any pods through the filter.
29+
* The MCP controller is crashing or stuck.

modules/proc-mcp-gateway-register-mcp-server.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ spec:
9393
* Replace the `spec.targetRef.namespace:` field value with the namespace where your `HTTPRoute` CR is applied. In this example, `_<mcp_test>_` is used.
9494
* Replace the `credentialRef.name:` field value with the name of your `Secret` CR. In this example, `_<mcp_server_one_secret>_` is used. You can omit this parameter if your MCP server does not require authentication or authorization.
9595
* For more information about these parameters, see "Understanding the `MCPServerRegistration` custom resource."
96+
+
97+
[IMPORTANT]
98+
====
99+
A `toolPrefix` value cannot include spaces or special characters.
100+
====
96101
97102
. Apply the CR by running the following command:
98103
+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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-ext-mcp-server-auth-issues_{context}"]
7+
= Troubleshooting external MCP server authentication issues
8+
9+
[role="_abstract"]
10+
If your registered external MCP server fails authentication and returns `401` or `403` errors, troubleshoot by checking the credentials and the logs.
11+
12+
.Prerequisites
13+
14+
* You installed {mcpg}.
15+
* You installed {prodname}.
16+
* You installed the {oc-first}.
17+
* You configured a `Gateway` object.
18+
* You configured an `HTTPRoute` object for the gateway.
19+
* You registered an external MCP server.
20+
* You created a `Secret` CR for authentication.
21+
22+
.Procedure
23+
24+
. Check that a Secret custom resource (CR) exists and that it has the correct `label` by running the following command:
25+
+
26+
[source,terminal,subs="+quotes"]
27+
----
28+
$ oc get secret _<secret_name>_ -n _<namespace>_ --show-labels
29+
----
30+
+
31+
* Replace `_<secret_name>_` with the name of your `Secret` CR.
32+
* Replace `_<namespace>_` with the namespace where your `Secret` CR is applied.
33+
34+
. Verify the `Secret` CR contents by running the following command:
35+
+
36+
[source,terminal,subs="+quotes"]
37+
----
38+
$ oc get secret _<secret_name>_ -n _<namespace>_ -o yaml
39+
----
40+
+
41+
* Replace `_<secret_name>_` with the name of your `Secret` CR.
42+
* Replace `_<namespace>_` with the namespace where your `Secret` CR is applied.
43+
44+
. Check the `MCPServerRegistration` CR `credentialRef` parameter value by running the following command:
45+
+
46+
[source,terminal,subs="+quotes"]
47+
----
48+
$ oc get mcpsr _<mcpsr_name>_ -n _<namespace>_ -o yaml | grep -A 3 credentialRef
49+
----
50+
+
51+
* Replace `_<mcpsr_name>_` with the name of your `MCPServerRegistration` CR.
52+
* Replace `_<namespace>_` with the namespace where your `MCPServerRegistration` CR is applied.
53+
54+
. Ensure that the `Secret` CR has the label `mcp.kuadrant.io/secret: "true"`.
55+
56+
. Verify that the `Secret` CR data key matches the `credentialRef.key` in the `MCPServerRegistration` CR.
57+
58+
. Check the credential format.
59+
60+
. Verify that the credential you are using has the necessary permissions for the external service.
61+
62+
. Check the MCP gateway broker component logs for credential errors by running the following command:
63+
+
64+
[source,terminal,subs="+quotes"]
65+
----
66+
$ oc logs -n _<mcp_system>_ deployment/mcp-gateway | grep -i auth`
67+
----
68+
+
69+
Replace `_<mcp_system>_` with the name of your MCP gateway deployment.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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-ext-mcp-server-connect-issues_{context}"]
7+
= Troubleshooting external MCP server authentication issues
8+
9+
[role="_abstract"]
10+
If your external MCP server cannot connect, or if tools are not appearing, you can troubleshoot by checking custom resources (CRs) and network settings.
11+
12+
.Prerequisites
13+
14+
* You installed {mcpg}.
15+
* You installed {prodname}.
16+
* You installed the {oc-first}.
17+
* You configured a `Gateway` object.
18+
* You configured an `HTTPRoute` object for the gateway.
19+
* You registered an external MCP server.
20+
* You created a `Secret` CR for authentication.
21+
22+
.Procedure
23+
24+
. If you are seeing errors such as `502 Bad Gateway` and `403 Forbidden`, check the `ServiceEntry` CR by running the following command:
25+
+
26+
[source,terminal,subs="+quotes"]
27+
----
28+
$ oc get serviceentry -n _<namespace>_
29+
----
30+
+
31+
Replace with the `_<namespace>_` where the `ServiceEntry` CR is applied.
32+
33+
.. If the command returns an empty list, create a `ServiceEntry` CR to allow egress.
34+
35+
. For detailed troubleshooting, such as to checks ports and the TLS setting, examine the `ServiceEntry` CR activity by running the following command:
36+
+
37+
[source,terminal,subs="+quotes"]
38+
----
39+
$ oc describe serviceentry _<se_name>_ -n _<namespace>_
40+
----
41+
+
42+
* Replace with the `_<se_name>_` with the name the `ServiceEntry` CR.
43+
* Replace with the `_<namespace>_` where the `ServiceEntry` CR is applied.
44+
45+
. Verify that `ServiceEntry` CR `hosts` values are exact matches external `hostname` values.
46+
47+
. If you are seeing `TLS` errors, verify that a `DestinationRule` CR exists by running the following command:
48+
+
49+
[source,terminal,subs="+quotes"]
50+
----
51+
$ oc get destinationrule -n _<namespace>_
52+
----
53+
+
54+
Replace with the `_<namespace>_` where the `DestinationRule` CR is applied.
55+
56+
.. If the previous command returns `No resources found in <namespace> namespace`, then create a `DestinationRule` CR.
57+
58+
.. Ensure that `DestinationRule` CR `host` values exactly match `ServiceEntry` CR host values.
59+
60+
.. Check the `TLS` configuration in `DestinationRule` CR.
61+
62+
. For detailed troubleshooting of actual connection details, such as encryption, load balancing, and connection pooling, examine the `DestinationRule` CR by running the following command:
63+
+
64+
[source,terminal,subs="+quotes"]
65+
----
66+
$ oc describe destinationrule _<dr_name>_ -n <namespace>
67+
----
68+
+
69+
* Replace with the `_<dr_name>_` with the name the `DestinationRule` CR.
70+
* Replace with the `_<namespace>_` where the `DestinationRule` CR is applied.
71+
72+
.. Ensure that your network egress policies allow external traffic from the pod.
73+
74+
. Test the DNS resolution by running the following command:
75+
+
76+
[source,terminal,subs="+quotes"]
77+
----
78+
$ oc run -it --rm debug --image=_<image_path/name>_ --restart=Never -- \
79+
nslookup _<external_hostname>_
80+
----
81+
+
82+
* Replace `_<image_path/name>_` with the path to your application image.
83+
* Replace `_<external_hostname>_` with your external MCP server `hostname` parameter value.
84+
85+
. Test the external connectivity by running the following command:
86+
+
87+
[source,terminal,subs="+quotes"]
88+
----
89+
$ oc run -it --rm debug --image=_<image_path/name>_ --restart=Never -- \
90+
curl -v https://_<external_hostname_url>_
91+
----
92+
+
93+
* Replace `_<image_path/name>_` with the path to your application image.
94+
* Replace `_<external_hostname_url>_` with your external MCP server URL.
95+
96+
. Verify that the `HTTPRoute` CR `backendRef` value is configured with the correct external hostname.
97+
98+
. Ensure that the `HTTPRoute` CR has the `URLRewrite` filter applied to rewrite to the external hostname.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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-extension-not-ready_{context}"]
7+
= Troubleshooting an MCPGatewayExtension status of not ready
8+
9+
[role="_abstract"]
10+
You can troubleshoot when your `MCPGatewayExtension` custom resource (CR) shows a `Ready: False` state by running a few commands.
11+
12+
Common causes include the following errors and indicate an associated action:
13+
14+
* `InvalidMCPGatewayExtension`: This often means that the `targetRef` points to a Gateway object that does not exist, or you have a typing error in the `kind` or `group`.
15+
* `ReferenceGrantRequired`: This occurs if your extension is in one namespace but is trying to target a `Gateway` object in another. To fix this, you must apply a `ReferenceGrant` in the `Gateway` object namespace.
16+
* `Conflict`: Only one `MCPGatewayExtension` can target a specific `Gateway` object. If another extension is already pointing to the `Gateway` object you configured with a new extension, the new one fails.
17+
18+
.Prerequisites
19+
20+
* You installed {mcpg}.
21+
* You installed {prodname}.
22+
* You configured a `Gateway` object.
23+
* You configured an `HTTPRoute` object for the gateway.
24+
* You installed the {oc-first}.
25+
* You registered an MCP server.
26+
27+
.Procedure
28+
29+
. Check the status of the specific `MCPGatewayExtension` CR by running the following command:
30+
+
31+
[source,terminal,subs="+quotes"]
32+
----
33+
$ oc get mcpgatewayextension -n _<namespace>_
34+
----
35+
+
36+
Replace `_<namespace>_` with the namespace where your `MCPGatewayExtension` CR is applied.
37+
38+
. Check for conflicting `MCPGatewayExtension` CRs by running the following command:
39+
+
40+
[source,terminal,subs="+quotes"]
41+
----
42+
$ oc get mcpgatewayextension -A
43+
----
44+
+
45+
There must be only one extension per namespace.
46+
47+
. Verify that the target Gateway object exists by running the following command:
48+
+
49+
[source,terminal,subs="+quotes"]
50+
----
51+
$ oc get gateway -n _<gateway-namespace>_
52+
----
53+
+
54+
Replace `_<gateway-namespace>_` with the namespace where your `Gateway` object is applied.
55+
56+
. Check the `MCPServerRegistration` CR namespace and route status by running the following command:
57+
+
58+
[source,terminal,subs="+quotes"]
59+
----
60+
$ oc describe mcpsr _<mcpsr_name>_ -n _<mcpsr_namespace>_
61+
----
62+
+
63+
* Replace `_<mcpsr_name>_` with the names of your `MCPServerRegistration` CR is applied.
64+
* Replace `_<mcpsr_namespace>_` with the namespace where your `MCPServerRegistration` CR is applied.
65+
66+
. Verify that an `MCPGatewayExtension` CR exists in the same namespace as the `MCPServerRegistration` CR. If the two do not share the same namespace, you must create a `ReferenceGrant` CR.
67+
68+
. Ensure that the `MCPGatewayExtension` CR targets the `Gateway` object that the `HTTPRoute` CR is attached to.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
// Module included in the following assemblies:
3+
//
4+
// *mcp_gateway_config/mcp-gateway-troubleshooting.adoc
5+
6+
:_mod-docs-content-type: PROCEDURE
7+
[id="proc-mcp-gateway-ts-gateway-listener-not-working_{context}"]
8+
= Troubleshooting the gateway listener not working
9+
10+
[role="_abstract"]
11+
If your {mcpg} cannot reach an MCP endpoint at configured hostname, the cause might be that the `Listener` custom resource (CR) you configured is not working. You can troubleshoot this situation by using a few commands and some insight.
12+
13+
Use the following concepts in conjunction with the commands that follow to solve a non-functioning `Listener` CR:
14+
15+
* Ensure that your `Gateway` object has `Accepted` and `Programmed` conditions set to `True`.
16+
* Verify that the `hostname` in the `Listener `CR matches your DNS or hosts configuration.
17+
18+
.Prerequisites
19+
20+
* You installed {mcpg}.
21+
* You installed {prodname}.
22+
* You configured a `Gateway` object.
23+
* You configured an `HTTPRoute` object for the gateway.
24+
* You installed the {oc-first}.
25+
* You registered an MCP server.
26+
27+
.Procedure
28+
29+
. Check 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 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`.
37+
38+
. Check the full metadata and status history for one specific `Gateway` object by running the following command:
39+
+
40+
[source,terminal,subs="+quotes"]
41+
----
42+
$ oc describe gateway _<gateway_name>_ -n _<namespace>_
43+
----
44+
+
45+
* Replace `_<gateway_name>_` with the name of the `Gateway` object.
46+
* Replace `_<namespace>_` with the namespace where the `Gateway` object is applied.
47+
* This command can help you figure out why a `Gateway` object is stuck in `Pending` by checking for port conflicts and verifying that `SSL/TLS` certificates are correctly attached to `Listener` CRs.
48+
49+
. Verify the `Listener` CR configuration by running the following command:
50+
+
51+
[source,terminal,subs="+quotes"]
52+
----
53+
$ oc get gateway _<gateway_name>_ -n _<namespace>_ -o yaml | grep -A 10 listeners
54+
----
55+
+
56+
* Replace `_<gateway_name>_` with the name of the `Gateway` object.
57+
* Replace `_<namespace>_` with the namespace where the `Gateway object` is applied.
58+
59+
. Check all of your `Listener` CR configurations at the same time by running the following command:
60+
+
61+
[source,terminal,subs="+quotes"]
62+
----
63+
$ oc get gateway _<gateway_name>_ -n _<namespace>_ -o jsonpath='{range .spec.listeners[*]}{.name}{"\t"}{.hostname}{"\t"}{.port}{"\n"}{end}' | jq
64+
----
65+
* Replace `_<gateway_name>_` with the name of the `Gateway` object.
66+
* Replace `_<namespace>_` with the namespace where your `Gateway` object is applied.
67+
* This command uses `jq` for formatting.
68+
69+
. Check that the Istio gateway pod is running by using the following command:
70+
+
71+
[source,terminal,subs="+quotes"]
72+
----
73+
$ oc get pods -n _<gateway_system>_ -l istio=ingressgateway
74+
----
75+
+
76+
* Replace `_<gateway_system>_` with the name of your `Gateway` object deployment.
77+
* This command checks the status of Envoy-proxy pods and returns pod, traffic flow, and policy errors.
78+
79+
. Verify that the port you are trying to use is not already in use by running the following command:
80+
+
81+
[source,terminal]
82+
----
83+
$ oc get gateway -A -o yaml | grep "port:"
84+
----

0 commit comments

Comments
 (0)