jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.56k stars 4.02k forks source link

Kubernetes support: cassandra, elk, consul #4205

Closed pascalgrimaud closed 7 years ago

pascalgrimaud commented 8 years ago

As suggested on Twitter (@deepu105, @PierreBesson, @saturnism), Kubernetes support need to be improved:

Feel free to code one part of this, if someone is motivated :star:

pascalgrimaud commented 8 years ago

I'm working first on npm test for kubernetes

PierreBesson commented 8 years ago

I think we should use Helm and officially supported charts, this will make our job easier: https://github.com/kubernetes/charts They already have config for mysql, mariadb, mongodb, elasticsearch, consul.

pascalgrimaud commented 8 years ago

I'm working on elasticsearch @PierreBesson : https://github.com/kubernetes/charts seems interesting but I don't see how it can be used with our subgenerator.

raphaelbrugier commented 8 years ago

I'm interested in helping with Cassandra and Kafka. Can you please tell me where to start or describe more the problems?

PierreBesson commented 8 years ago

Hi @raphaelbrugier, similar to a what's already in place in the docker-compose subgen we want to have a multi-node Cassandra that works out of the box with a JHipster app and that can scale at will. One resource that might help you is the 1000 cassandra node demo using JHipster :

https://github.com/k8s-for-greeks/gpmr

Good luck !

PierreBesson commented 8 years ago

And the related k8s blog post : http://blog.kubernetes.io/2016/07/thousand-instances-of-cassandra-using-kubernetes-pet-set.html?m=1

raphaelbrugier commented 8 years ago

Awesome! Thanks, I'll read that and play a bit with k8s as a start.

pascalgrimaud commented 8 years ago

@raphaelbrugier thanks !!

Don't hesitate to ping me if you need help

raphaelbrugier commented 8 years ago

Thanks @pascalgrimaud, I'll start with Kafka then. I have just installed minikube and started playing with k8s, so I need to get familiar with it first.

Does the hacktoberfest tag mean you'll owe me a beer for my contribution? ;)

pascalgrimaud commented 8 years ago

@raphaelbrugier sure, with pleasure !!:beers:

raphaelbrugier commented 8 years ago

So, after playing with the JHipster k8s generator and researching on how to integrate Kafka I have a couple of questions.

1) What are the features that the configuration generated by JHipster should cover? Production ready? high availability? fault tolerant? Or is it just for local testings with minikube and to give examples of a kubernetes configuration?

I am asking, because when I tested with a single JHipster app and a mysql database, the webapp was correctly fault tolerant (I killed the container and k8s restarted a new one as expected) but the mysql container was not. All the tables and data were gone. I may be wrong somewhere in my tests because the k8s mysql service declares a volume data which is supposed to survive a container failure (if restarted in the same pod).

2) Kafka is not currently "supported" by kubernetes By supported, I mean there is no official example or charts unlike for Cassandra.

An example for Zookeeper using petset has just landed in the official repository. I have found this work in progress but I have not tested it yet.

Here are my options, also depending on 1)

What is your point of view on this?

pascalgrimaud commented 8 years ago

@raphaelbrugier :

Note: everything here is my point of view

Docker-compose subgen generates docker-compose yaml files. k8s subgen should do the same, with the appropriate syntax.

Last word about volume:

PierreBesson commented 8 years ago

@rafaelbrugier You make really good points. Configuring "prod" deployments of things like Cassandra or Zookeeper is very hard. This is what the DataMC team is doing at Ippon for their Cassandra and Kafka managed services offering and it's a full time job. Anyway it would be lying to imply that we provide a complete prod setup here. A simple deployment or petset should be enough to help users get started.

raphaelbrugier commented 8 years ago

Hi,

Thank you both for your answers.

Ok, let's keep it simple and just add a warning in the documentation page to explain it's up to the users to tweak for their needs (more fault tolerant == more complicated).

I'll just port the Kafka docker-compose file to k8s.

@pascalgrimaud About volumes:

@PierreBesson Julien demoed us DataMC last week and that was pretty impressive! Good job guys!

pascalgrimaud commented 8 years ago

@raphaelbrugier : I was refering to this https://github.com/jhipster/generator-jhipster/blob/master/test/templates/compose/05-cassandra/src/main/docker/cassandra-migration.yml#L12-L13

With Kubernetes, we have probably to find another way to play CQL scripts

raphaelbrugier commented 8 years ago

Oh thanks Pascal, I forgot about this one :). Yes, we'll have to rethink how to apply the CQL scripts when deploying in k8s. I have always preferred the idea to have the deployment pipeline responsible for applying the scripts, so it really depends on what we want to achieve with the k8s default setup.

I have not make any progress on Kafka because I'm running into a problem with the existing k8s configuration for a monolithic/mysql JHipster app. The fist time I used the generated configuration and deployed it in minikube, it worked fine. Now, when I try to use it again, the JHipster app complains it can not reach the mysql address:

Caused by: java.net.UnknownHostException: jhipsterapp-mysql.default.svc.cluster.local: unknown error

If I change the webapp container configuration (SPRING_DATASOURCE_URL) to point directly to the IP of the MySQL container, it works.

I have tried to recreate everything from scratch, deleting the .minikube folder and recreating the JHipster application, but the same problem occurred.

I'm not sure of the reason, probably a DNS problem? Any idea?

pascalgrimaud commented 8 years ago

Can you look at :

Maybe it's related to this issue

EDIT: oh I read too fast. It's not related to kafka. I'll have a look tomorrow: monolithic+mysql, so ?

pascalgrimaud commented 8 years ago

@raphaelbrugier : I retry to deploy a simple monolith application. Everything works fine on my minikube

raphaelbrugier commented 8 years ago

Thanks @pascalgrimaud, Yes, my problem is with a very simple JHipster monolith application from scratch with just a MySQL database. It was working fine the first time I used the k8s generator, but I doest not work anymore.

I'll give it another try tomorrow with a fresh install of minikube and the latest JHipster master.

pascalgrimaud commented 8 years ago

I begin to work on consul

pascalgrimaud commented 8 years ago

Edit: I only begin to write tests for consul, but I don't have time to finish it. I will do it later -> as I will help for testing angular2

pascalgrimaud commented 7 years ago

@PierreBesson : we need to test https://github.com/kubernetes-incubator/kompose :-)

PierreBesson commented 7 years ago

Yes I have heard that it has improved a lot recently and now supports docker-compose v2.

jdubois commented 7 years ago

@pascalgrimaud @PierreBesson is there still work to do here? Nothing on this ticket since October, and Cassandra support isn't very important (only very few people use it, less than 2%)

pascalgrimaud commented 7 years ago

I think we can close it, as there are few feedback on Kubernetes. And it can be done later! Nothing here is urgent.