Giter Site home page Giter Site logo

imskyer / java-microprofile-on-kubernetes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibm/java-microprofile-on-kubernetes

0.0 2.0 0.0 5.79 MB

This application demonstrates the deployment of a Java based microservices application using Microprofile on Kubernetes Cluster. MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes

Home Page: https://developer.ibm.com/code/patterns/deploy-microprofile-java-microservices-on-kubernetes

License: Apache License 2.0

Shell 100.00%

java-microprofile-on-kubernetes's Introduction

Build Status

Deploy MicroProfile based Java microservices on Kubernetes.

Read this in other languages: 한국어**.

This code demonstrates the deployment of a Java based microservices application using MicroProfile and Microservice Builder on Kubernetes.

MicroProfile is a baseline platform definition that optimizes Enterprise Java for a microservices architecture and delivers application portability across multiple MicroProfile runtimes. Microservice Builder provides means to develop, test and deploy your microservices using a Java and MicroProfile based programming model and tools.

The Microservice Builder sample application is a web application for managing a conference and is based on a number of discrete microservices. The front end is written in Angular; the backing microservices are in Java. All run on WebSphere Liberty, in Docker containers managed by Kubernetes.

Flow

Included Components

Getting Started

Kubernetes

In order to follow this guide you'll need a Kubernetes cluster. If you do not have access to an existing Kubernetes cluster then follow the instructions (in the link) for one of the following:

Note: These instructions are tested on Kubernetes 1.7.3. Your mileage may vary if you use a version much lower of higher than this.

After installing (or setting up your access to) Kubernetes ensure that you can access it by running the following and confirming you get version responses for both the Client and the Server:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-08-31T09:14:02Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-09-18T20:30:29Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

Helm

Some of the instructions utilize Helm to deploy applications. If you don't already have it you should Install Helm and then initialize Helm on your Kubernetes cluster:

$ helm init
$HELM_HOME has been configured at /home/username/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Happy Helming!

Steps

1. Install Microservice Builder add-ons

First, clone our repository.

git clone https://github.com/IBM/Java-MicroProfile-on-Kubernetes.git
cd Java-MicroProfile-on-Kubernetes

Then, install the 2 add-ons:

Install Microservice Builder Fabric:

$ helm repo add mb http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/microservicebuilder/helm/
$ helm install --name fabric mb/fabric

Install ELK:

$ helm repo add mb-sample https://wasdev.github.io/sample.microservicebuilder.helm.elk/charts
$ helm install --name sample-elk mb-sample/sample-elk

It will take up to 20 minutes to install the Microservice Builder Add-ons on your Kubernetes Cluster. If you want to build the application yourself now would be a good time to do that. However for the sake of demonstration you can use the images that we've already built and uploaded to the journeycode docker repository.

Before you start deploying your application, make sure the Microservice Builder Add-ons are installed and running.

$ kubectl get pods --show-all=true
NAME                                    READY     STATUS      RESTARTS   AGE
fabric-zipkin-4284087195-d6s1t          1/1       Running     0          11m
key-retrieval-deploy-gkr9n              0/1       Completed   0          11m  # Make sure this job is completed
kibana-dashboard-deploy-rd0q5           1/1       Running     0          11m
sample-elk-sample-elk-461262821-rp1rl   3/3       Running     0          11m
secret-generator-deploy-bj1jj           0/1       Completed   0          11m  # Make sure this job is completed

2. Optional Step - Deploy Istio

If you want to deploy and use Istio to control traffic between the microservices you can deploy it with the following command:

$ kubectl create -f istio
namespace "istio-system" created
clusterrole "istio-pilot-istio-system" created
clusterrole "istio-initializer-istio-system" created
clusterrole "istio-mixer-istio-system" created
...
...
initializerconfiguration "istio-sidecar" created

3. Deploy Microservices

Now, deploy the microservices with the command:

$ kubectl create -f manifests
persistentvolume "cloudant-pv" created
persistentvolumeclaim "cloudant-pv-claim" created
service "cloudant-service" created
deployment "cloudant-db" created
...
...

Note: this will deploy all of the kubernetes manifests in the manifests/ directory. Take some time to explore their contents to get an idea of the resources being used to deploy and expose the app.

After you have created all the services and deployments, wait for 10 to 15 minutes. You can check the status of your deployment on Kubernetes UI. Run 'kubectl proxy' and go to URL 'http://127.0.0.1:8001/ui' to check when the application containers are ready.

Kubernetes Status Page

After a few minutes you should be able to access the application. Part of our deployment is a Kubernetes Ingress resource. If your Kubernetes cluster already has an ingress service such as IBM Cloud Private then you should be able to access the application with no further changes.

However if you are using minikube, or a Kubernetes cluster that does not have an ingress service you have one more step before you can access your cluster. On minikube you can do the following:

$ minikube addons enable ingress
ingress was successfully enabled
$ minikube ip
192.168.99.100

With an Ingress controller enabled you can access the app via the IP provided by minikube above.

Now you can use the link http://[Public IP] to access your application on browser and use http://[Public IP]:30500 to access your Kibana for tracking the metrics.

Web application home page

Web-app Home Page

When you click on speaker name

Speaker Info

When you click on schedules link

Schedule Info

When you click on vote link

Vote Info

Kibana discover page

Kibana

Troubleshooting

  • If your microservice instance is not running properly, you may check the logs using
    • kubectl logs <your-pod-name>
  • To delete a microservice
    • kubectl delete -f manifests/<microservice-yaml-file>
  • To delete all microservices
    • kubectl delete -f manifests
  • To delete istio & kubectl delete -f istio
  • To delete Microservice Builder add-ons
    • helm delete --purge sample-elk
    • helm delete --purge fabric

References

java-microprofile-on-kubernetes's People

Contributors

animeshsingh avatar anthonyamanse avatar dolph avatar hisunah avatar ishangulhane avatar jzaccone avatar loafyloaf avatar paulczar avatar tomcli avatar wwalisa avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.