diff --git a/pages/about.mdx b/pages/about.mdx index 1e6ba51..2a10bc7 100644 --- a/pages/about.mdx +++ b/pages/about.mdx @@ -17,13 +17,23 @@ Hi, I'm Hiranmaya Gundu. I'm a software developer from India, currently based in
-I'm a recent graduate of PES University, and as of Jan 2020, have about a year of professional experience in the industry. -I currently work as a Full Stack engineer, and learnt professional JavaScript and Web Development on the job. +I'm an incoming graduate student at University of Southern California, and as of July 2021, have 2.5 years of +professional experience in the industry. + This website was born out of a desire to learn about React's server side rendering capabilities, as well as TypeScript.
-I'm currently actively looking to further my education through a graduate program. I have a strong interest in the Systems fields. +## Work Experience + +[MiQ Digital India](https://wearemiq.com) (Jun 2019 - Aug 2021) + +_Software Engineer - II_ + +I was part of the team that built a workflow engine that was used by analysts internally. I helped build and maintain +a drag-and-drop workflow editor, built integrations with other services using both REST APIs as well as using a +cutsom Kafka based messaging system. I also helped contanierize and kuberntize the application, and built CI/CD +pipelines for it. ## Technical Skills diff --git a/pages/posts/config-in-kube.mdx b/pages/posts/config-in-kube.mdx index bee6120..94423fb 100644 --- a/pages/posts/config-in-kube.mdx +++ b/pages/posts/config-in-kube.mdx @@ -1,6 +1,5 @@ import Mark from "components/Mark"; import Head from "components/Head"; -import Callout from "components/Callout"; export const meta = { published: true, diff --git a/pages/posts/debug-java-apps-kube.mdx b/pages/posts/debug-java-apps-kube.mdx new file mode 100644 index 0000000..e791152 --- /dev/null +++ b/pages/posts/debug-java-apps-kube.mdx @@ -0,0 +1,90 @@ +import Mark from "components/Mark"; +import Head from "components/Head"; +import Callout from "components/Callout"; + +export const meta = { + published: true, + publishedAt: "2021-06-21", + title: "Remote debug Java Applications running on Kubernetes", + summary: "A guide to debugging Java applications running on Kubernetes", +}; + + + +## Remote Debugging Java Applications in Kubernetes + +Recently, when implementing a feature in our application, I had a `NullPointerException` issue that would occur only on Kubernetes. +This issue was not reproducible on local, and was not reproducible running the docker container either. To debug this issue, +I had to set up a remote debugging session. These are the steps to setup this session:- + +First, change the Java startup command by adding the jdb parameters. +In my applications case, it meant changing it from + +```bash +java -cp ".:./conf/:./lib/\*" -noverify com.app.name +``` + +to + +```bash +java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=_:5005 -cp ".:./conf/:./lib/_" -noverify com.app.name +``` + + + +Note that the exact parameters differ based on JDK version. The above example is valid for JDK 9 or higher. + + + +At this point you have an application that has exposed a debug port on port 5005. If you run this application, the first printed +line would be: `Listening for transport dt_socket at address: 5005`. If this gets printed you know that the java application has +been correctly configured. + +This application can now be deployed on K8S. We need to expose the 5005 port in the container section of our deployment so that it +is accessible from outside Kubernetes. In your `deployment.yaml` make the following +change to expose the port: + +```yaml +spec: + template: + spec: + containers: + - name: java-app + ports: + - containerPort: 5005 + name: "debug" +``` + +Kubectl provides us a port forward command to be able to access a pods port as if it were a local port. +To set this up do the following: + +Get the name of the pod using the `get pods` command. + +```bash +$ kubectl get pods -n app-namespace +NAME READY STATUS RESTARTS AGE +java-app-6c54c9b858-7bpbp 3/3 Running 1 6d2h +``` + +Then use the `kubectl port-forward` command to forward the 5005 port of the pod to your local machine. + +```bash +$ kubectl port-forward java-app-6c54c9b858-7bpbp 5005:5005 -n app-namespace + # With this, the debug session should be available at localhost:5005. +``` + +Next, you need to setup the debug configuration in your favourite IDE. My preference is to use IntelliJ IDEA. In IDEA, the steps are as follows: + +- From the main menu, select Run | Edit Configurations or press `⌃⌥R` then 0. +- In the Run/Debug Configurations dialog, click the Add New Configuration button and select Remote. +- Fill out the details for host as localhost and port and 5005. Make sure you select the correct JDK version. +- Save the configuration + +
+ +With this configuration is saved you can click on the debug icon to debug +at any time! diff --git a/public/images/debug-java-kube-seo.png b/public/images/debug-java-kube-seo.png new file mode 100644 index 0000000..d3397f0 Binary files /dev/null and b/public/images/debug-java-kube-seo.png differ