We do not have permission to use port-forward, how could we enable debug logging for kuma sidecar? (The default log level of kuma sidecar is info.)
How to enable debug logging for kuma sidecar without using port-forward
Uses:
Kong Gateway
TL;DR
How do I enable debug logging for the kuma sidecar without using kubectl port-forward?
Use kubectl exec to open a shell in the kuma sidecar container, then send an HTTP POST request to its local admin API with wget to set the log level to debug. The same approach can set the log level back to info afterward.
Steps
You have to log in to the kuma sidecar and send an HTTP POST request with the wget command.
-
Log in to the kuma sidecar.
kubectl exec -it <pod-name> -c kuma-sidecar -n <namespace> -- sh -
Enable debug logging with the following
wgetcommand.wget http://localhost:9901/logging?level=debug --post-data='' -O /tmp/res -
Exit the kuma sidecar container and confirm the log level.
kubectl logs -f <pod-name> -c kuma-sidecar -n <namespace>
For the case you want to set the log level back to info, please log in to the kuma sidecar and run the following wget command.
wget http://localhost:9901/logging?level=info --post-data='' -O /tmp/res