Deploying JHipster in Oracle Kubernetes Engine

sendilkumarn
4 min readDec 2, 2018

Speaking at Oracle Codeone this year was an amazing experience. I was able to see many of my Java (super)heroes there. Last but not least made some amazing friends there. That is the best thing about any conference right, make friends 👫, see legends 🤓, (re)learn from the community 📖.

Note: The icing on the cake was getting a 4.45 / 5 rating for my talk 😃

Hipsters in action :)

After the conference, I made a todo list of the things that I want to learn and experiment. Few of them are

  • The Fibers in Java
  • Play with Oracle Cloud
  • OpenJ9 & its GC
  • Micronaut

This post is all about Oracle Cloud. While there are a lot of exciting things in Oracle Cloud. I chose to start with Oracle Kubernetes Engine.

Let us dive into action. The very first thing is, of course, create a Kubernetes cluster.

Goto menu > Developer services > Container Clusters(OKE).

Finding OKE presence in the sidebar

Then click on “Create Cluster”.

Create Cluster button

In the modal popup, enter the required details like the cluster name, Kubernetes engine version, and Node pool details.

Create Kubernetes cluster

Added to that, you also have those additional add-ons at the bottom. While Kubernetes Dashboard is somewhat essential for any use case. Tiller (Helm Enabled) is an additional and interesting option. I have chosen both. But it is not mandatory for the application that we will be deploying today.

Note: Are you facing an error, when creating the Kubernetes cluster? Fear not check this amazing blog post from Lucas. https://goo.gl/jZXhjL

Wait, what is the application that we are gonna deploy today?

A Spring Boot based application with Angular frontend. With Spring Data, Spring Security, Actuators wired. Add a database and few deployment scripts to create Docker files and Kubernetes configurations. Well that is a lot. Don’t worry we have JHipster for that.

JHipster

JHipster is a development platform that helps you to build, develop and deploy Spring boot based Angular or React or VueJS applications.

Creating an application is so easy with JHipster. Let us create an application.

Open your terminal and enter

npm install -g generator-jhipster

Create a folder and then run jhipster inside the folder.

Choose default values for all the questions. The application is generated now.

For Kubernetes configuration files, create another folder and then run the jhipster kubernetes command. Answer all the default values. Check the screenshot below for more details.

Note: JHipster kubernetes command expects “Docker” to be installed and running.

That is it, now we will go to our applications folder and run ./mvnw package -Pprod verify jib:dockerBuild

This will build the application and create a Docker image.

Now we can have to tag the image and push it into the Docker repository.

$ docker image tag jhipster sendilkumarn/jhipster
$ docker push sendilkumarn/jhipster

Now you are ready to deploy your applications into Oracle Kubernetes cluster.

But we have just created an engine but there are no nodes available for the Kubernetes cluster to operate.

To create node in the OKE, Go to the cluster and click on “Add Node Pool”.

Fill in the node name, the Kubernetes version, the OS, the subnet where it will live.

Create Node pools

Now let us connect our K8s running in Oracle cloud into our local terminal.

Click on “Access KubeConfig“ and follow the instructions.

Access kubeconfig

Once you have connected, you can then check the Kubernetes cluster information. To get the available pods in the OKE cluster, run

kubectl get pods --namespace kube-system

Kube-system pods

Now go to the folder, where you have created K8s configuration file with JHipster and run ./kubectl-apply.sh

Deploying into Kuberenetes

After few seconds, the application is started and available in the following external IP. (since we have chosen LoadBalancer for Kubernetes service type).

Deployed in Kubernetes

Great that you have reached this point. Congrats on deploying your application into Oracle Kubernetes Engine.

Check out this post for Microservices deployment with Istio and Kubernetes.

Interested to do JHipster with Kotlin. Check this out.

--

--