Common troubleshooting procedures
Troubleshoot service registration and discovery issues
Follow these steps:
First, confirm that the following information is correct and belongs to the correct workspace:
InstanceId: The unique identifier of the middleware instance.
AntVIP: The middleware uses AntVIP for addressing.
AccessKey ID: The access key ID.
AccessKey Secret: The access key secret.
If the information is correct, troubleshoot the service registration and discovery process. The troubleshooting order is: Application > MOSN > Registry Center.
ImportantTo perform the following troubleshooting steps in a container, you must obtain the kubeconfig for the corresponding user workspace.
Troubleshoot the application
On the node, run the following command to access the application container:
kubectl exec -it sofa-service-thrf4-whtpc -c <application_name>
Run the following command to check if the MOSN registered port is open:
curl -v http://127.0.0.1:13330Go to the
/home/admin/logsdirectory.The framework and log file names may differ, but the log directory is always the same. For example, the log file for both Dubbo and Spring Cloud is spring.log.
Search for the keywords dataId or EnterpriseMeshRegistry.


MOSN:
Enter the mosn-sidecar-container.

Find the log file:
/home/admin/logs/mosn/default.logSearch for
system config initto check if the user-configured four-tuple information is correct.
Search for
dataId or registryto check if the service was registered successfully.
Check if the notification interface of the registry center is open:
netstat -anp | grep 9600
Troubleshoot service throttling issues
The service throttling configuration is sent from the DsrConsole microservice to MOSN through DRM. Follow these steps:
At the product layer, check the application's push configurations and records.

Check DsrConsole (middleware tenant).
Go to the
/home/admin/logs/directory and check for error logs.Check MOSN:
Find the log file
/home/admin/logs/mosn/default.log.Search the log file for keywords such as the application name, method name, or serviceRateLimitConfig. Check if the content in the value field matches the content that you entered on the frontend.
find *.log | grep -rn "Alipay.cloudMeshTestJavaServer:name=com.alipay.guardian.client.sofa.drm.GuardianDrm.serviceRateLimitConfig,version=3.0@DRM"
Troubleshoot service routing issues
The DsrConsole microservice sends the routing configuration to the default namespace of Kubernetes (K8s) through OpenAPI. Pilot then uses ListAndWatch to monitor changes in the corresponding Custom Resource (CR) and notifies MOSN. Follow these steps:
Check DsrConsole:
Go to the
/home/admin/logs/directory.Search for the configuration using keywords.
Using SigmaRouterRuleDispatcher or dataId, check if the content of the body matches your configuration.

Check Cloud Mesh OpenAPI:
If the return value in step 1 is not 200, check the specific error message and take the appropriate action. For example, a
404 cluster not founderror indicates that the K8s cluster information cannot be found. In this case, submit a ticket.If the token or endpoint is incorrect, submit a ticket.
Check K8s:
Check the content of the CRs. The CRs are in the default namespace of your K8s cluster. The routing-related CRs are virtualservices and destinationrules. Verify that their content matches what you entered.

Check Pilot:
Check the logs to verify that the address specified by
PILOT_SERVER_ADDRESSis reachable. If it is not, submit a ticket. The following log is an example of an error:2019-10-1117:01:24,236[ERROR][normal] fail to create stream client: rpc error: code =Unavailable desc = all SubConns are inTransientFailure, latest connection error: connection error: desc ="transport: Error while dialing dial tcp xxx.xxx.xxx.xxx:xxx: i/o timeout"Check the logs to verify that Pilot authorization was successful. If it was not, submit a ticket and check the InstanceId, AccessKey ID, and AccessKey secret. The following log is an example of an error:
2019-10-1117:07:12,518[WARN][xds][ads client]get resp timeout: rpc error: code =Unknown desc = missing auth part of service node "xxx",retry after 1sCheck if MOSN received the xDS content.
Run
curl [podIP]:34901/api/v1/config_dumpto retrieve the content. If the content is empty or missing, submit a ticket.
Check MOSN:
Check if the routing configuration was sent to the service consumer by following these steps:
Enter the MOSN container of the service consumer. Use the dataId or xds keyword to check if the version number and weight are correct.

Run the
find default.log | grep -rn "xds"command.The following is an example:

Troubleshoot MOSN Sidecar injection failures
Follow these steps:
In the console, check if a cluster is created and the Sidecar injection feature is enabled.
Enable Mesh for the cluster if it is not already enabled.
NoteIn the Sidecar injection configuration, the Sidecar name must be mosn. Currently, only the mosn Sidecar is supported.
Check if a default template or an injection configuration rule is enabled.
The following is an example of an enabled default template:
NoteThe highlighted part is the default template. For each Sidecar type (container or virtual machine), only one default template can be enabled.
The following is an example of an enabled injection configuration rule:
NoteEach time an injection rule is enabled, a ConfigMap is generated. During Sidecar injection, the conditions in the rule are matched.
If only an injection rule is enabled, check if the matching conditions in the rule match the content of the pod that requires the injection.
Check if the environment variables specified for the operator match the annotations in the pod.

Check if the application pod's YAML file contains an annotation with the key
ake.cafe.sofastack.io/mosn-inject=true.
NoteThe figure above shows that the Sidecar feature is enabled for the corresponding pod.
When creating a pod, check if K8s calls the operator's webhook.
Enter the operator container.
kubectl exec -it sidecar-operator-7564cbf97b-jbpzz -n hxz-smmp bashModify the namespace based on your actual environment.
Monitor the
sidecar-operator.logfile.tail -f /home/admin/logs/sidecar-operator.logDelete the pod and then restart it. Check if
sidecar-operator.logcontains any log output.kubectl delete pod crpc-client-5584848c67-nhzspThe figure below shows log output from the operator. The red box indicates that the
sidecar-mosn-container-template-170template was injected.
If there is log output but no template is matched, check if the mosn-template-ns startup parameter of the Sidecar operator matches the namespace of the template. If they do not match, modify the environment variable and restart the operator.
The figure below shows the mosn-template-ns startup parameter of the Sidecar operator:

The figure below shows the namespace of the template. The default namespace is cloudmesh. The namespace under tenant 000001 is also cloudmesh.
If there is no log output, check if the configured webhook address is correct.
kubectl -n hxz-smmp get cm mesh-webhooks -oyaml















