Service Mesh FAQ

Updated at:

This topic lists frequently asked questions (FAQs) and provides solutions for common issues encountered when using Service Mesh.

What microservice frameworks does Service Mesh support?

Service Mesh supports mainstream microservice frameworks such as Dubbo and Spring Cloud.

XDS configuration is not delivered

Cause: Pilot is not running or the network connection between Pilot and MOSN is unavailable.

Solution:

  1. Check whether MOSN is connected to Pilot.

    Enter the MOSN container and run the following command. If a connection to Pilot does not exist, check whether the Pilot address is correct.

    netstat -na | grep 15050
  2. Enter the MOSN container and check the /home/admin/logs/mosn/default.log file to see whether the XDS client was initialized.

    If a log similar to the following appears, the XDS client failed to connect. This may be because the Pilot address is incorrect or Pilot is not running.

    2020-12-07 16:02:50,791 [INFO] fail to create stream client: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 11.**.**.206:15050: connect: connection refused"
    2020-12-07 16:02:50,791 [INFO] [xds] [ads client] stream client reconnect failed, retry after 4s
    2020-12-07 16:02:50,973 [INFO] [xds] [ads client] stream client closed, sleep 1s and wait for reconnect
    
  3. Check whether MOSN received the configuration.

    If the Pilot pod is not running, wait for it to start. MOSN has an automatic reconnection mechanism, so no changes are required.

    Wait for a log entry similar to the following to appear. This indicates that the connection is restored.

    [xds] [sds subscriber] stream client reconnected

Version number of the registered provider is missing

On the Kubernetes service, check whether the application YAML file has the app.kubernetes.io/version: 1.0.0 label.

    Service throttling does not take effect

    The service throttling flow is DsrConsole > DRM > MOSN.

    1. Log on to the microservice console and check whether the throttling rule is configured correctly.

      If you set the throttling direction to client-side, you must specify the client application to throttle traffic on the client. If you set the throttling direction to server-side, you must specify the server application to throttle traffic on the server.

    2. Check whether DRM pushed the throttling rule.

      The following figure shows that the throttling rule was pushed.Image 10

    3. Check whether MOSN and DRM are connected.

      For client-side throttling, run the following command:

      kubectl exec -it crpc-client-2-5747cf49db-q9mnn -c mosn-sidecar-container bash
      netstat -nalp |grep 9880

      Output similar to the following figure indicates that MOSN and DRM are connected.mv

    4. Check whether MOSN received the throttling rule.

      Open the MOSN log file at /home/admin/logs/mosn/drm.access.log and search for the keyword RateLimit:

      grep -irn "RateLimit" *.log

      限流日志

    5. If the throttling rules are not received, verify the connection between DsrConsole and DRM.

      netstat -nalp |grep 9880

      If the connection is normal but the rule was not received, check whether the tenant information configured in MOSN matches the tenant information in DsrConsole. If they do not match, update the information to match the tenant in MOSN.

    Service circuit breaking does not take effect

    The service circuit breaking flow is DsrConsole > DRM > MOSN.

    1. Log on to the microservice console and check whether the circuit breaking rule is configured correctly.

      If you set the circuit breaking direction to client-side, you must specify the client application to enable circuit breaking on the client. If you set the direction to server-side, you must specify the server application to enable circuit breaking on the server.

    2. Check whether DRM pushed the circuit breaking rule.

      The following figure shows that the circuit breaking rule was pushed.

    3. Check whether MOSN and DRM are connected.

      For client-side circuit breaking, run the following command:

      kubectl exec -it crpc-client-2-5747cf49db-q9mnn -c mosn-sidecar-container bash
      netstat -nalp |grep 9880

      Output similar to the following figure indicates that MOSN and DRM are connected.35

    4. Check whether MOSN received the circuit breaking rule.

      Open the MOSN log file at /home/admin/logs/mosn/drm.access.log and search for the keyword circuitBreakerRules:

      grep -irn "circuitBreakerRules" *.log

      熔断

    5. If you do not receive the circuit breaking rules, check the connection between DsrConsole and DRM.

      netstat -na | grep 9880

      If the connection is normal but the rule was not received, check whether the tenant information configured in MOSN matches the tenant information in DsrConsole. If they do not match, update the information to match the tenant in MOSN.

    Service degradation does not take effect

    The service degradation flow is DSRConsole > DRM > MOSN.

    1. Log on to the microservice console and check whether the service degradation rule is configured correctly.

      Service degradation occurs on the client. Check whether the configuration items, such as application, service, and method, are correct.

    2. Check whether DRM pushed the degradation rule.

      A message similar to the one in the following figure indicates that a connection has been established between MOSN and DRM.35

    3. Check whether MOSN and DRM are connected.

      kubectl exec -it crpc-client-2-5747cf49db-q9mnn -c mosn-sidecar-container bash
      netstat -nalp |grep 9880

      Output similar to the following figure indicates that MOSN and DRM are connected.35

    4. Check whether MOSN received the degradation rule.

      Open the MOSN log file at /home/admin/logs/mosn/drm.access.log and search for the keyword downgradeRule:

      grep -irn "downgradeRule" *.log

      The following figure shows that MOSN received the degradation rule.降级

    5. If downgrade rules are not received, check the connection between DsrConsole and DRM.

      netstat -na | grep 9880

      If the connection is normal but the rule was not received, check whether the tenant information configured in MOSN matches the tenant information in DsrConsole. If they do not match, update the information to match the tenant in MOSN.

    Fault injection does not take effect

    Fault injection can occur on the client or the server. It is typically used to inject an exception for a specific period or to inject an exception directly. If a fault injection rule does not take effect, first check whether the rule is configured correctly. For example, client-side injection requires the client application name, and server-side injection requires the server application name.

    The fault injection flow is DSRConsole > DRM > MOSN.

    1. Log on to the microservice console and check whether the fault injection rule is configured correctly.

    2. Check whether DRM pushed the fault injection rule.

      The following figure shows that DRM pushed the rule.

    3. Check whether MOSN and DRM are connected.

      kubectl exec -it crpc-client-2-5747cf49db-q9mnn -c mosn-sidecar-container bash
      netstat -nalp |grep 9880

      Output similar to the following figure indicates that MOSN and DRM are connected.55

    4. Check whether MOSN received the fault injection rule.

      Open the MOSN log file at /home/admin/logs/mosn/drm.access.log and search for the keyword faultInjectRules:

      grep -irn "faultInjectRules" *.log

      If you do not receive a fault injection rule, verify that the connection between DsrConsole and DRM is working correctly.

      netstat -na | grep 9880

      If the connection is normal but the rule was not received, check whether the tenant information configured in MOSN matches the tenant information in DsrConsole. If they do not match, update the information to match the tenant in MOSN.

    Fault isolation does not take effect

    The fault isolation flow is DSRConsole > DRM > MOSN.

    1. Log on to the microservice console and check whether the fault isolation rule is configured correctly.

      For example, the following figure shows an incorrect configuration. The Abnormal Ratio Threshold multiplied by the Abnormal Ratio Multiplier is 200, but the maximum error limit is 100.

    2. Check whether DRM pushed the fault isolation rule.

      The following figure shows that the rule was pushed.

    3. Check whether MOSN and DRM are connected.

      kubectl exec -it crpc-client-2-5747cf49db-q9mnn -c mosn-sidecar-container bash
      netstat -nalp |grep 9880

      Output similar to the following figure indicates that MOSN and DRM are connected.35

    4. Check whether MOSN received the fault isolation rule.

      Open the MOSN log file at /home/admin/logs/mosn/drm.access.log and search for the keyword faultToleranceRules:

      grep -irn "faultToleranceRules" *.log

      The following figure shows that MOSN received the fault isolation rule.77

    5. If a fencing rule is not received, verify the connection between DsrConsole and DRM.

      netstat -na | grep 9880

      If the connection is normal but the rule was not received, check whether the tenant information configured in MOSN matches the tenant information in DsrConsole. If they do not match, update the information to match the tenant in MOSN.

    Service routing does not take effect

    Routing rules are delivered in the following order:

    1. After you complete the configuration in the console, DsrConsole is called to send the rule to Cloudmesh OpenAPI.

    2. OpenAPI writes the configuration to the Kubernetes APIServer.

    3. Pilot listens for configuration changes in the Kubernetes APIServer and sends the configuration to the client's MOSN.

    You can check the process in reverse order:

    1. Check whether the routing rule was delivered to MOSN.

      Enter the MOSN container and run the following command to view the log file and check whether the routing rule was delivered.

      kubectl exec -it crpc-client-1-84d49d4468-sbtc5 -c mosn-sidecar-container bash
      Note

      crpc-client-1-84d49d4468-sbtc5 is the name of the client pod. Replace it with the actual name of your client pod when you run the command.

      The following figure shows that the routing rule has been delivered.28

    2. Run the kubectl get virtualservice -n default command to check whether the routing rule was delivered to the Kubernetes APIServer.

      Note

      virtualservice is a custom value. Modify it as needed when you run the command.

      The following figure shows that the content has been delivered.27

    3. Run the netstat -an|grep 15050 command to check whether a persistent connection is established between MOSN and Pilot.

      The following figure shows that a persistent connection is established.03

    4. Run the kubectl get pod -n cloudmesh -o wide command to check whether the IP addresses of the Pilot and APIServer applications are correct.

      In the following figure, check the IP configurations of openapi-7b794d6796-x2wp4 and pilot-fb4777d78-f9nml.24

      The OpenAPI address must be configured in DsrConsole, as shown in the following figure:The openApiUrl property specifies the address of OpenAPI and is used to deliver routing rules. The Pilot address must be configured in the application's YAML file as a MOSN environment variable. The configuration is as follows:

      - name: PILOT_SERVER_ADDRESS
        value: 192.**.**.144
    5. View the list of all services.

      Enter the client's MOSN container and run the curl localhost:13330/servicesnapshot command to view the list of all services.Image 22If the list of services you see is different from the list in the console, the list in the MOSN container prevails.

    Note the following when you configure service routing:

    • If you configure multiple routing rules, rules with higher priority are matched first.

    • If traffic splitting is enabled and the destination group has no service instances, the traffic is forwarded to other groups.

    • If degradation is enabled and no service instance matches the current rule, other rules are matched.

    • If no rules match, the routing rule becomes invalid. A service instance in the local zone is selected by default. The zone information is in the application's YAML file.

    • If you delete an enabled routing rule, the client randomly selects a server to call.

    • For exact traffic matching, traffic is first filtered based on service instance properties. The filtered traffic is then routed based on the traffic destination.

    • Multiple service instance group conditions are combined with a logical AND. All conditions must be met.

      p33

    • If you configure multiple rules for the same application and the same interface service, the rules are displayed together on the page.

    • If you set the routing granularity to the application level, you can enter an asterisk (*) in manual mode or select all services in selection mode.

    Service authentication does not take effect

    The service authentication flow is DSRConsole > Cloudmesh OpenAPI > Write to APIServer > Pilot listens for CR resource changes > Deliver authentication rule to MOSN.

    You can troubleshoot by tracing the effective path in reverse order:

    To troubleshoot, check the flow in reverse order:

    1. Enter the DSRConsole machine and run the env | grep auth.dispatch.target.sigma command to view the environment variable.

      If the environment variable does not exist, add -Dauth.dispatch.target.sigma=true.

    2. Run the following command to enable DEBUG logging for default.log.

      curl -X POST \
       http://127.0.0.1:34901/api/v1/update_loglevel \
        -d '{
        "log_level":"DEBUG",
        "log_path":"./logs/mosn/default.log"
      }'

    3. Go to the /home/admin/logs/mosn directory and run the grep 'mosnrbac' *.log command.

      If a log entry similar to the following appears, the authentication rule has been delivered to MOSN. If authentication still does not take effect, check whether your rule is configured correctly.mv If MOSN did not receive the authentication rule, continue to the next step.

    4. Check whether the connection to Pilot is normal.

      • If output similar to the following figure appears, the connection to Pilot is normal.36

      • If the connection to Pilot is not normal, check whether the Pilot address is correct.

        • If the Pilot address is incorrect, correct it.

        • If the Pilot address is correct, continue to the next step.

    5. In the console, run the following command to view the MOSN RbacConfig resource. Check whether the custom resource (CR) was delivered to the Kubernetes APIServer.

      kubectl get mosnrbacconfigs -n default --sort-by=.metadata.creationTimestamp | tail -n +2
      • If output similar to the following figure appears, the resource has been delivered to the Kubernetes API Server. Note the timestamp.

        33

      • If the resource is not in Kubernetes, continue to the next step.

    6. Check whether the OpenAPI address is correctly configured in the DSRConsole dynamic configuration.

      • If the OpenAPI address is incorrect, correct it.

      • If the OpenAPI address is correct, continue to the next step.

    7. Enter the Cloudmesh OpenAPI container and view the logs in /home/admin/logs/cloudmesh.

      • openapi.log: Error logs are printed to this file.

      • request.log: Call request logs are printed to this file.

      Send a request and check whether the request reaches OpenAPI and whether any errors are logged.

    Trace is not displayed

    In MOSN, check whether the TRACING_SWITCH environment variable is set to a valid value, either SkyWalking or Zipkin.

    env | grep TRACING_SWITCH
    • If TRACING_SWITCH=SkyWalking, check whether SKY_WALKING_ADDRESS and SKY_WALKING_PORT are correctly configured with the SkyWalking address.

    • If TRACING_SWITCH=Zipkin, check whether ZIPKIN_ADDRESS and ZIPKIN_PORT are correctly configured with the Zipkin address.

    Metric data is not collected

    1. Check whether the business collection address is correctly configured in Prometheus.

    2. Run kubectl get po -o yaml to check whether the corresponding annotations are applied.

    3. Run curl podip:34903/metrics to check whether there is any metric output.

    How to view services published in a container

    1. Enter the MOSN container locally:

      docker exec -it mosn-container bash
    2. Inside the MOSN container, run the following command to view the current MOSN Pub service host address:

      curl localhost:34901/api/v1/config_dump?allclusters= | python -m json.tool

    How to check if a plugin loaded successfully

    Run the following command to check:

    grep codec /home/admin/logs/mosn/default.log  --col
    
    load go plugin codec succeed: /go/src/mosn.io/extensions/go-plugin/build/codecs/bolt/codec-bolt.so

    How to adapt to Apple M1 chips

    1. Install Rosetta.

      Computers with M1 chips need to have Rosetta installed. The command is as follows:

      softwareupdate --install-rosetta --agree-to-license
    2. Install Docker for Mac.

      For the download link, see Mac with Apple chip.

    3. Restart your computer or Docker.

    4. Pull the scaffold code again.

      In the go-plugin directory, run the following command:

      git pull

    Open source Mesh demo compilation issues

    When you compile sofastack-mesh-demo, you may fail to pull a JAR file and receive an error similar to the following:

    [ERROR] Non-resolvable import POM: 
    Could not transfer artifact com.alipay.sofa:sofaboot-enterprise-dependencies:pom:3.2.2 
    from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories:
    [alipay-cloud-server@public (http://mvn.cloud.alipay.com/nexus/content/groups/open, 
    default, releases)] @ line 23, column 25

    Place the settings.xml file in the ~/.m2/ directory and compile again.