Common Commands Used for Troubleshooting
When troubleshooting Anypoint Service Mesh, you might need to perform various common tasks:
Retrieve Adapter Logs
To retrieve the adapter logs of a single pod when you are troubleshooting an issue:
$ kubectl -n service-mesh logs $(kubectl -n service-mesh get pod -l namespace=replace_with_namespace -o jsonpath='{.items[0].metadata.name}') -c mule
If you have multiple replicas, you can change the index on the items array.
Access the Adapter
When troubleshooting Anypoint Service Mesh, you might need to access and display information about the adapter.
To display information about the adapter pods:
-
Display all the pods created under the namespace service-mesh:
$ kubectl get pods -n service-mesh
-
Access the adapter:
$ kubectl -n service-mesh exec -ti adapter-pod-name
Retrieve Policies and Contracts Information from the Adapter
When troubleshooting issues with Anypoint Service Mesh, you might need to retrieve policies and contracts details. To retrieve the details, obtain an Anypoint Service Mesh management dump file:
+
$ asmctl management dump
+
You can view the information from the replace_with_adapter_name-policies-folder.tar.gz
folder.
Modify Log4j Configuration
When troubleshooting Anypoint Service Mesh, you might need to modify the Log4j configuration:
-
Display the adapter pod:
$ kubectl get pods -n service-mesh
-
Download the current log4j configuration:
$ kubectl cp -c mule service-mesh/replace_with_grpcmule_pod_name:/usr/src/app/conf/log4j2.xml log4j2.xml
-
Update the downloaded copy of log4j2.xml as required and upload it again to the pod:
$ asmctl management config log4j --namespace=_replace_with_namespace --log4jFile=log4j2.xml
Because the
log4j
configuration file checks for changes every 60 seconds, you might have to wait to confirm your modification.
Update the Service Mesh License
When troubleshooting Anypoint Service Mesh, you might need to update the license:
-
Update the existing license with one that you know is valid:
$ asmctl management config license --license=/path/to/license.lic
-
Redeploy the adapter:
$ kubectl -n service-mesh patch $(kubectl -n service-mesh get deploy -l namespace=replace_with_namespace -oname) --type=json -p="[{\"op\": \"replace\", \"path\": \"/spec/template/metadata/annotations/kubectl.kubernetes.io~1restartedAt\",\"value\":\"$(date -u +%FT%TZ)\"}]"