{"action":"closed","issue":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4378","repository_url":"https://api.github.com/repos/jhipster/generator-jhipster","labels_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4378/labels{/name}","comments_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4378/comments","events_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4378/events","html_url":"https://github.com/jhipster/generator-jhipster/issues/4378","id":184955003,"number":4378,"title":"[Kubernetes]Virtualbox 5.0.x is broken with Minikube","user":{"login":"raphaelbrugier","id":579318,"avatar_url":"https://avatars.githubusercontent.com/u/579318?v=3","gravatar_id":"","url":"https://api.github.com/users/raphaelbrugier","html_url":"https://github.com/raphaelbrugier","followers_url":"https://api.github.com/users/raphaelbrugier/followers","following_url":"https://api.github.com/users/raphaelbrugier/following{/other_user}","gists_url":"https://api.github.com/users/raphaelbrugier/gists{/gist_id}","starred_url":"https://api.github.com/users/raphaelbrugier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphaelbrugier/subscriptions","organizations_url":"https://api.github.com/users/raphaelbrugier/orgs","repos_url":"https://api.github.com/users/raphaelbrugier/repos","events_url":"https://api.github.com/users/raphaelbrugier/events{/privacy}","received_events_url":"https://api.github.com/users/raphaelbrugier/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2016-10-24T21:07:15Z","updated_at":"2016-11-01T16:32:39Z","closed_at":"2016-11-01T16:32:39Z","body":"##### **Overview of the issue**\r\n\r\nWhen the two containers, jhipsterapp and jhipsterapp-mysql are run in Kubernetes (minikube), the app can't reach the mysql container. \r\n\r\nThis follows up the discussion in #4205 where I reported having a problem to run a monolith freshly generated in minikube with kubernetes.\r\nThe first time I used the kubernetes generator, this worked but since then every JHipster application I generated can't connect to the mysql container.\r\n##### **Reproduce the error**\r\n- delete my ~/.minikube folder then reinstalled minikube\r\n- update JHipster to the latest master\r\n- create a new Jhipster application\r\n\r\nThen run the commands:\r\n\r\n```\r\n- mkdir k8s\r\n- cd k8s\r\n- yo jhipster:kubernetes\r\n- cd ..\r\n- ./mvnw package -Pprod docker:build\r\n- docker tag jhiapp raphaelbrugier/jhiapp\r\n- docker push raphaelbrugier/jhiapp\r\n- minikube start\r\n- kubectl apply -f jhiapp\r\n- minikube dashboard\r\n```\r\n\r\nThe dashboard displays the jhiapp container not started with this stacktrace:\r\n\r\n```\r\n2016-10-24T20:41:18.665884833Z Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Communications link failure\r\n2016-10-24T20:41:18.665887470Z \r\n2016-10-24T20:41:18.665889907Z The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.\r\n2016-10-24T20:41:18.665892582Z  at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:528)\r\n2016-10-24T20:41:18.665895187Z  at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:118)\r\n2016-10-24T20:41:18.665897983Z  at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:94)\r\n2016-10-24T20:41:18.665900690Z  at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)\r\n2016-10-24T20:41:18.665903379Z  at com.mycompany.myapp.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:67)\r\n2016-10-24T20:41:18.665906033Z  at com.mycompany.myapp.config.liquibase.AsyncSpringLiquibase.afterPropertiesSet(AsyncSpringLiquibase.java:57)\r\n2016-10-24T20:41:18.665909111Z  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)\r\n2016-10-24T20:41:18.665913015Z  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)\r\n2016-10-24T20:41:18.665915907Z  ... 24 common frames omitted\r\n2016-10-24T20:41:18.665918489Z Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure\r\n2016-10-24T20:41:18.665921118Z \r\n2016-10-24T20:41:18.665926061Z The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.\r\n2016-10-24T20:41:18.665928956Z  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n2016-10-24T20:41:18.665931725Z  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\r\n2016-10-24T20:41:18.665934435Z  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n2016-10-24T20:41:18.665937146Z  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)\r\n2016-10-24T20:41:18.665939722Z  at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)\r\n2016-10-24T20:41:18.665942286Z  at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:988)\r\n2016-10-24T20:41:18.665944869Z  at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)\r\n2016-10-24T20:41:18.665947575Z  at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251)\r\n2016-10-24T20:41:18.665950163Z  at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)\r\n2016-10-24T20:41:18.665952751Z  at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)\r\n2016-10-24T20:41:18.665955302Z  at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)\r\n2016-10-24T20:41:18.665978135Z  at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)\r\n2016-10-24T20:41:18.665981194Z  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n2016-10-24T20:41:18.665983931Z  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\r\n2016-10-24T20:41:18.665986648Z  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n2016-10-24T20:41:18.665989309Z  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)\r\n2016-10-24T20:41:18.666030481Z  at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)\r\n2016-10-24T20:41:18.666033242Z  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)\r\n2016-10-24T20:41:18.666035859Z  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)\r\n2016-10-24T20:41:18.666038563Z  at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95)\r\n2016-10-24T20:41:18.666041257Z  at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101)\r\n2016-10-24T20:41:18.666043914Z  at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:316)\r\n2016-10-24T20:41:18.666046640Z  at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:518)\r\n2016-10-24T20:41:18.666049317Z  ... 31 common frames omitted\r\n2016-10-24T20:41:18.666051923Z Caused by: java.net.UnknownHostException: jhiapp-mysql.default.svc.cluster.local: unknown error\r\n2016-10-24T20:41:18.666054628Z  at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)\r\n2016-10-24T20:41:18.666062188Z  at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)\r\n2016-10-24T20:41:18.666065110Z  at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)\r\n2016-10-24T20:41:18.666067801Z  at java.net.InetAddress.getAllByName0(InetAddress.java:1276)\r\n2016-10-24T20:41:18.666070433Z  at java.net.InetAddress.getAllByName(InetAddress.java:1192)\r\n2016-10-24T20:41:18.666075775Z  at java.net.InetAddress.getAllByName(InetAddress.java:1126)\r\n2016-10-24T20:41:18.666078445Z  at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:188)\r\n2016-10-24T20:41:18.666081140Z  at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)\r\n2016-10-24T20:41:18.666083953Z  ... 47 common frames omitted\r\n2016-10-24T20:41:18.666086552Z \r\n```\r\n##### **Suggest a Fix**\r\n\r\nAs a workaround, I can manually set the 'SPRING_DATASOURCE_URL' property in the webapp to the mysql containe ip.\r\n\r\n```\r\n▶ kubectl describe pod jhiapp-mysql-507293976-8oci6 |grep IP\r\nIP:     172.17.0.4\r\n```\r\n\r\nThen in the webapp kubernetes deployment, replace `SPRING_DATASOURCE_URL`\r\nfrom: `jdbc:mysql://jhiapp-mysql.default.svc.cluster.local:3306/jhiapp?useUnicode=true&characterEncoding=utf8&useSSL=false`\r\nto: `jdbc:mysql://172.17.0.4:3306/jhiapp?useUnicode=true&characterEncoding=utf8&useSSL=false`\r\n\r\n`minikube service jhiapp` opens the browser to `http://192.168.99.100:30751/` and the application is running correctly.\r\n##### **JHipster Version(s)**\r\n\r\n3.9.1, master (881eb76)\r\n##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**\r\n\r\n```\r\n{\r\n  \"generator-jhipster\": {\r\n    \"jhipsterVersion\": \"3.9.1\",\r\n    \"baseName\": \"jhiapp\",\r\n    \"packageName\": \"com.mycompany.myapp\",\r\n    \"packageFolder\": \"com/mycompany/myapp\",\r\n    \"serverPort\": \"8080\",\r\n    \"authenticationType\": \"session\",\r\n    \"hibernateCache\": \"ehcache\",\r\n    \"clusteredHttpSession\": false,\r\n    \"websocket\": false,\r\n    \"databaseType\": \"sql\",\r\n    \"devDatabaseType\": \"h2Disk\",\r\n    \"prodDatabaseType\": \"mysql\",\r\n    \"searchEngine\": false,\r\n    \"messageBroker\": false,\r\n    \"buildTool\": \"maven\",\r\n    \"enableSocialSignIn\": false,\r\n    \"rememberMeKey\": \"aee8821bf98a2b9d166a36e331f803412735963b\",\r\n    \"useSass\": false,\r\n    \"applicationType\": \"monolith\",\r\n    \"testFrameworks\": [\r\n      \"gatling\"\r\n    ],\r\n    \"jhiPrefix\": \"jhi\",\r\n    \"enableTranslation\": false,\r\n    \"appsFolders\": [\r\n      \"jhiapp\"\r\n    ],\r\n    \"directoryPath\": \"../\",\r\n    \"jwtSecretKey\": \"7664942f050c6b4cc4178eedddfe7b2c39705cb9\",\r\n    \"dockerRepositoryName\": \"raphaelbrugier\",\r\n    \"dockerPushCommand\": \"docker push\",\r\n    \"kubernetesNamespace\": \"default\"\r\n  }\r\n}\r\n```\r\n##### **Browsers and Operating System**\r\n\r\n```\r\nProductName:    Mac OS X\r\nProductVersion: 10.11.3\r\nBuildVersion:   15D21\r\n```\r\n\r\nMinikube version:  v0.12.0\r\nkubectl version:\r\n\r\n```\r\nClient Version: version.Info{Major:\"1\", Minor:\"4\", GitVersion:\"v1.4.4+3b417cc\", GitCommit:\"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56\", GitTreeState:\"not a git tree\", BuildDate:\"2016-10-21T22:33:18Z\", GoVersion:\"go1.7.3\", Compiler:\"gc\", Platform:\"darwin/amd64\"}\r\nServer Version: version.Info{Major:\"1\", Minor:\"4\", GitVersion:\"v1.4.3\", GitCommit:\"4957b090e9a4f6a68b4a40375408fdc74a212260\", GitTreeState:\"clean\", BuildDate:\"1970-01-01T00:00:00Z\", GoVersion:\"go1.7.1\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\n```\r\n"}}
{"actor":{"display_login":"raphaelbrugier"}}