I this post we will review how to use the mirrord plugin within JetBrains IDE.
Mirrord is a new open source tool enabling developer to run processes on the local development machine as if the process is running on a remote kubernetes cluster. It actually works by connecting to a pod, and capturing network and IO requests on the pod, mirroring these to the local development machine. See the architecture flow from the mirrord sire:
The mirrord plugin for JetBrains IDEs simplifies development to a whole new level. Let have a quick walk-though of the steps to use it.
For this example, I have a deployment and a service named "guibackend" on the remote kubernetes cluster, and I want to run it locally, but I need to use other services to run it. The redis service is part of the kubernetes cluster, so I cannot access it from my local development machine. Let use mirrord to run it as if it is located on the remote kubernetes cluster.
Install the mirrord plugin
In the GoLand IDE, double click the Shift key, type "Plugins", and open the plugins window:
Click on Marketplace, search for mirrord plugin, and click the Install button:
That's all, mirrord is installed.
Using the mirrord plugin
We now have a new button on the toolbar to enable/disable run and debug through mirrord:
Next we can easily run the service locally on the machine as if it was remotely installed on the kubernetes cluster. When mirrord is enabled, running the program displays a popup to select the target pod/deployment:
Once we select the guibackend deployment, we now run on local development machine, but we get the IO and network of the remote pod. Pretty amazing!
This mirrord can be configured to match our requirement, for example, I want always to select the guibackend deployment without the selection popup, and I want not just to mirror the network requests, but instead I want to steal them, hence I use the following configuration:
For complete configuration options, see here.
Final Note
The mirrord is doing a real great job at simplify development and debugging processes on a kubernetes cluster environment. I find it very easy to use, and I highly recommend using it!
No comments:
Post a Comment