Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateful app in kubernetes YAML files #9576

Closed
1 task done
Tonterias opened this issue Apr 18, 2019 · 6 comments
Closed
1 task done

Stateful app in kubernetes YAML files #9576

Tonterias opened this issue Apr 18, 2019 · 6 comments

Comments

@Tonterias
Copy link

Overview of the issue

Hi,

I am not sure if I spotted a bug, but I can not make this piece work and I wonder if you can make it work.

PREMISE: I am trying to deploy an jhipster app in Google Cloud Platform using the automatic kubernetes YAML files that are created by Jhipster. Right now, it deploys but as a STATELESS app. I can not think of a mayority of users who wants to deploy Jhipster (with any DB) as Stateless app. Once the db pod is dead, your data is lost. So I think that the default behaviour should be STATEFUL (so this part is also a new feature request).

Said that, I try to modify the automatic generated files to be STATEFUL and here is the posible bug. Why do you use the apiVersion: extensions/v1beta1 for the jhipster-postgresql.yml and the apiVersion: apps/v1 for the jhipster-deployment.yml since both are Deployments. As fas as I know, apps/v1 is for StatefulSets (which makes sense for the databases). On the other hand, I'm no expert on k8s but I think PersistentVolume and PersistentVolumeClaim are needed to have a Stateful app. I created a question at Stack with the case: https://stackoverflow.com/questions/55620417/kubernetes-storageclass-does-not-retain-existing-data/55622803

Anyway, do you have a example where a Statefull database works? I would love to see it.

Thanks for your great job

Motivation for or Use Case

Because every Jhipster App uses a database and if the data is not persistent there is no use in having Kubernetes deployments. Am I wrong in this?

Reproduce the error

When you delete a Pod, the new pod can not find the old database files.

Related issues

No

Suggest a Fix

Do you have a example where a Statefull database works? To demonstrate that it works. I would love to see it. But if not, then there could be a bug (or it may be a feature request) or both.

JHipster Version(s)

Version 5.8.2. I could not test with beta 6.0 cause it give another issue (but I will) #9572

JHipster configuration

Not applicable, those are the YAML files.

Entity configuration(s) entityName.json files generated in the .jhipster directory

Not applicable, those are the YAML files.

Browsers and Operating System

Not applicable, those are the YAML files.

  • Checking this box is mandatory (this is just to show you read everything)
@PierreBesson
Copy link
Contributor

Hi @Tonterias,
Your concerns about the incoherent API versions are resolved on our current version and should already be available in the v6 beta (you can install it withnpm install -g generator-jhipster@beta).

JHipster configuration
Not applicable, those are the YAML files.

⚠️ We need your JHipster configuration as it will allow us to generate the appropriate kubernetes yaml files for your app otherwise we cannot reproduce your bug.

As for your concern that the data is not persistent. Please keep in mind that the kube configurations we generate is only good for getting started. For production, we recommend that you use a database outside of kubernetes. However you are correct that we could move our default database configuration to StatefulSets.

@Tonterias2
Copy link

Hi Pierre,

Thanks for your answer. Sorry, I'm not in my computer these days. I will send you the config files as soon as I get back or test the whole thing when the issue 9572 gets fixed.

Here are the Yaml files in case they are of any help in the meantime: https://github.com/Tonterias/jhipsterpress/tree/master/k8s/TestLoadBalancer

Please, can you tell me (where is) how to implement that recommendation to use a database outside of K8s? Any blog that explains that point?

Before reading your answer, I thought that putting the database inside K8s was the proposed solution by Jhipster!!! What do you recommend?

I am trying to finish a production version of open source Spingular.com site made with jhipster and I would like to write a blog about how I did it and explaining why I did it that way.

On the other hand, I'm not sure if it is a bug.

Again, thanks for your answer. I really need that solution!

@PierreBesson
Copy link
Contributor

@Tonterias2 It seems that you have a monolith app so deploying on Kubernetes is going to be expensive and complex to maintain. I would recommend you use Google App Engine, we have a subgen for it (jhipster gae) and it works similarly to Heroku. For the database outside of k8s, you can use a managed database offering from a Cloud Provider. This is what we use for JHipster Online : https://cloud.google.com/sql/

To get back to your issue. Do you mind if we close it. The wording is not precise enough. I think we should improve our kubernetes docs because they are severely lacking.

@Tonterias
Copy link
Author

Thanks for your answer Pierre,

Do what you think it is better. If you want me to be more precise, let me know and I will do it. No problem. I think this is the only way I can help.

The subgen looks pretty difficult to me. Do you mind if I ask you if I get lost? I will follow your advice and try it. Where can I contact with you.

Sorry for my English

@PierreBesson
Copy link
Contributor

Please contact me directly on Twitter for help. I see that you have done a lot of work on your spingular project and written a lot of helpful documentation on it. The docs you wrote in https://github.com/Tonterias/jhipsterpress/tree/master/ReadMe would be good to contribute to the official website. Also your work project is a good Jhipster showcase.

@Tonterias
Copy link
Author

Thanks Pierre,

I did that documentation on GitHub because it would be easier to update. Feel free to include it on the official site. It is on the showcase, I just have to modify the name from JhipsterPress to Spingular, but I need to move Spingular to Google
first because it takes 1 minute to wake up the Heroku free tier and I can not make it with work with kubernetes. I'm not sure I will be able to move it to App Engine. I will contact you in Twitter if I get in trouble. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants