 Hello everyone. Today in this video we are going to take a look at developing Java applications, Java microservices locally from a developer perspective and building and deploying those into Kubernetes. What we are going to look at and target is how developers do things today and how that might look like when building for cloud platform like Kubernetes. Typically, in traditional developers are creating their applications, their walls are and putting them inside application servers. But in today's microservice era, we are directly creating overjars and we are running them directly. We are not putting them inside application servers, but this is only the first half of the story. The second half of the story is what kind of JVM we are running our application on, what operating system JVM is running on, what are the transitive dependencies of our JVM and so on. So all of that stuff can be packaged as a Docker container and we can take our JVM, we can take our application and operating system and we can package all of that as a Docker image and we can hire it as an implementation detail. So what we are going to do is we are going to take a binary snapshot of our system and we are going to deploy it to Kubernetes, which is a very popular cloud platform. But moving to Kubernetes is not very smooth and it requires some additional workloads like writing manifest, writing Docker files, etc. and it's not possible to maintain the same traditional Java developer workflow. So today we will be looking at one of the projects called Eclipse JQ and how it tries to simplify all these additional workloads and it maintains the same old traditional Java experience while moving you to the cloud platforms. So let's jump to the demo and for demo I'll be going to my browser. I have the spring initializer here and I'll be generating a Maven project with a spring web dependency, additional dependency with me. So I'll be generating it. So I'll be going back to my terminal and I'll just quickly unzip it. So let me go inside the demo project and I'll let me do compilation. Okay, so let me quickly open it up in my IDE and see. Alright, so it looks like it's loaded. So let's see what's inside. There's this package called com.example.demo and there's this class time application which seems to be the driver class of this application. So we need to add some REST controller. Let's add our own REST controller here. So we'll call it demo endpoint. Alright, so it's going to be a REST controller and for that in that we are going to have a simple get mapping of a simple response. Hello, we're going to have a get mapping of hello which would produce application JSON. Okay, public dummy response. Hello, it's going to restore not dummy response of a greeting. Let's say hello. Let me just go ahead and create that model loss also for the response. Dummy response. It would be a string and let me add a constructor also. Alright, let me add getters and setters for this as well. Generate getter and setter. Okay. Alright, looks like we are set. Let's try to run this and see whether it's working or not. So let me go ahead and do ambient spring boot, call and run. Okay, let's try to call an application. Let me go to my browser and to localhost. Alright, so it looks like we are getting the results as expected. So now we have this application but we want to deploy it to Kubernetes. We want to build a Docker image and we don't have any experience with Docker or Kubernetes. I mean, we do know what they are but we don't have very good expertise. So what I'll do is I'll add dependency to a formal XML. So I'll just go ahead and add a plugin called cliffjq. So I have added the plugin for Kubernetes main plugin which is going to handle all of the tasks related to building Docker image. Kubernetes manifest everything. So let me go back to my terminal and let's just see whether our mini cube is running or not. So let me check. Let me try to start it. Alright, so it looks like our mini cube has started. So I'll just go ahead and check. I'll have to build a Docker image for my application. For that I'll first expose the mini cubes Docker demo. I'll just do this. Alright, so it looks like we are using the mini cubes Docker demo now. So we have to build the Docker image. I'll just do mvn kt spilt. It's going to build a default opinionated Docker image for me. So it's going to... So it has triggered the Kubernetes main plugin and it uses this as the base image. That's jkips default which can obviously be configured. So it's going to download the image first and it's going to use this as a base image for application. So let me check our Docker images. Okay, it looks like this image was built a few seconds ago. Alright, as you can see it here. So we have built the Docker image. Now we want to push it to some registry. So in order to push it, we need to have the image name as per in the format of the registry requirements. For example, the first thing should be the username and second thing should be the name of the registry image. So I'll just configure this by adding a property inside my form.xml. I'll just say that there's a property called jqt-generator.name. And I'll say my application's username would be my Git Docker Hub username and the application's let's say artifact ID. Project.artifact ID. And then the project version. Alright, so let me go ahead and let me do my mvlki to split it again. Okay, so it looks like our image has been built. Alright, so in order to push the image, you need to provide, for example, right now I'm going to push to Docker Hub. So in order to push the image, you need to provide the credentials either in your even settings or inside the plugin configuration. You can provide it in the plugin configuration section as well. I mean right here in the configuration section and you can also do the traditional Docker logging. And it's going to just use the credentials that are provided in the Docker-config notation. So I'll just go ahead and I'll do mvlki-push and it's going to push to my Docker Hub. So as you can see, it's pushing to my Docker Hub account with artifact ID set to demo. Alright, so let me just verify whether the image has been pushed or not. So this is my Docker Hub and yeah, it looks like the image was pushed. So our image is generated and it's also pushed to the registry. So now we only have to worry about writing the Kubernetes manifest. And G-Cube also allows us to do that for us so that the code is mvlki-push-resource. And the resource code is going to generate all the manifest for us automatically based on some opinionated defaults. As you can see, it generated a default requirement and a default service for us. So let me go back to my ID to show what things it has generated. So I'll go to target folder, classes, meta, NF, JQ, Kubernetes. And you can see there are two things inside Kubernetes. First is the demo deployment, which is a default opinionated deployment, which can obviously be configured by which XML configuration and we can provide it through the resource fragment mode as well. But we'll look into that in later videos. So for now you can see it generated a default deployment service for you. So I'll go back to my terminal again. As you can see here, classes, meta, NF. These are the resources generated and now I want to apply those resources onto Kubernetes cluster. So let me go ahead and then we can just supply. So let's check. Okay, now pod is running already. So let me check the service. So it's a service of type plus type. So we'll need to search inside the Kubernetes cluster and we'll try to call it from within the cluster itself. Hello. All right. Looks like our application is running. So I'll just exit this link. And so the default service generates a type plus type. So we'll configure jq by adding a property that we want to serve as a type of output. So I'll go back to my IDE and I'll just add another property called jq.invature.jq-service.type. And I'll set it to notepad. So after this, I'll generate the resources again. Doing a vnqtis resource and I'll apply them again. Let me check the service again. Let me check my pods also. And since the services of type node port now, so we can access it from outside the minq cluster also. So I'll access it using the minq by p colon port that's provided. 30695 slash hello. All right. So our application is running now and we can access it from outside as well. So so far we have built and deployed our application. So jq also provides some help for utilities like lvnkators log. It can show logs of your application which is running inside Kubernetes. So apart from that, you can also debug your application which is inside Kubernetes from your IDE. So for that, you just need to do mvnkators debug. All right. So it has put forwarded to 5005. So I'll go back to my IDE and I'll add the debug configuration here. Remote configuration 45005 and I'll say Kubernetes debug. Okay. I'll say apply. Okay. And let me try to connect this and see if it gets connected or not. It says it's connected. So let's try to hit something. Let's try to set a break point somewhere. Let's set it here and let's try to hit the application. Hello. Okay. So upon hitting that endpoint, we are here and from here we can probably debug whatever the control. And once you are done with everything, you can see your application is running. You can simply clean everything up as well. So for that, there is a gold coin mvnkators and deploy. It's going to delete everything that was created during the apply phase. Okay. You can see it's in terminating state and everything seems to be deleted also. So I hope I have given you a brief overview of JQ. Reach out to us in case you have any queries. We are available on GitHub. We can submit issues there. You can also follow our Twitter channel in case of all the important announcements. If you want to stay tuned to that. We also have a GitHub channel in case you want to come up and chat with us and video queries. And we also have a website called atrips.org. Let's check you. So this concludes the demo guys. Thanks a lot for watching.