I am trying to deploy very simple app to google kubernetes. It has 3 containers: front end(html,javascript,angularjs, jquery), backend (Jersey Java), and db (postgres). Each container is deployed one pod. Backend and db has ClusterIP service, and front-end has LoadBalancer service. I can get successful response from my backend(further db) if I go to my front-end pod and run curl. curl http://back-service:8080/LocWebService/rest/authorize/admin1_admin1 But the front end app which is running same is failing. Please see the below. Error status is -1. What could be the reason? The code works without any issue in my local computer(Eclipse+Tomcat). I also added Dockerfile for my front end. See the below in the end.
<!DOCTYPE html>
<html>
<script
src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<style>
body
{
background-color: coral;
}
</style>
</head>
<body>
<div ng-app="myApp" ng-controller="loginController">
<form ng-submit="myFunc()">
<p>User name:<br><input type="text" ng-model="Name"></p>
<p>Password:<br><input type="password" ng-model="Password"></p>
<input type="submit">
</form>
</div>
<script>
var parseXml;
if (typeof window.DOMParser != "undefined") {
parseXml = function(xmlStr) {
return ( new window.DOMParser() ).parseFromString(xmlStr,
"text/xml");
};
} else if (typeof window.ActiveXObject != "undefined" &&
new window.ActiveXObject("Microsoft.XMLDOM")) {
parseXml = function(xmlStr) {
var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmlStr);
return xmlDoc;
};
} else {
throw new Error("No XML parser found");
}
var app = angular.module("myApp", []);
app.controller("loginController", function($scope, $http) {
$scope.myFunc = function ()
{
//window.parent.servhost="back-service";
$http.get("http://back-
service:8080/LocWebService/rest/authorize/"+$scope.Name+"_"+
$scope.Password)
.then(function(response) {
var response_code=response.data;
var temp=response.data;
var temp1=parseXml(temp).getElementsByTagName('name')
[0].firstChild.nodeValue;
response_code=temp1;
if (response_code=="1")
alert("User Name is wrong.");
if (response_code=="2")
alert("User Password is wrong.");
if (response_code=="0")
{
window.location.href =
"http://"+window.location.hostname+":8080/GeoWeb/html/successLogin.html";
top.left_bottom.retrieveUsersInfo($scope.Name);
window.parent.adName=$scope.Name;
}
if (response_code=="3")
alert("Either User Name or User Password is wrong.");
}).catch(
function(response) {
alert("return code: " + response.status);
});
}
});
</script>
</body>
</html>
//Dockerfile content for front end app
FROM tomcat:9.0
ADD myfrontend.war /usr/local/tomcat/webapps/GeoWeb.war
expose 8080
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transpor$ 22-Jul-2019 21:35:00.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.21 22-Jul-2019 21:35:00.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 4 2019 20:19:36 UTC 22-Jul-2019 21:35:01.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.21.0 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.14.127+ 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-11 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.3+7 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat 22-Jul-2019 21:35:01.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat 22-Jul-2019 21:35:01.035 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED 22-Jul-2019 21:35:01.038 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED 22-Jul-2019 21:35:01.039 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-U$ 22-Jul-2019 21:35:01.039 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/t$ 22-Jul-2019 21:35:01.039 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.$ 22-Jul-2019 21:35:01.040 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 22-Jul-2019 21:35:01.041 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.cata$ 22-Jul-2019 21:35:01.042 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListe$ 22-Jul-2019 21:35:01.042 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 22-Jul-2019 21:35:01.043 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat 22-Jul-2019 21:35:01.043 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat 22-Jul-2019 21:35:01.043 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp 22-Jul-2019 21:35:01.046 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using$ 22-Jul-2019 21:35:01.046 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filte$ 22-Jul-2019 21:35:01.047 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenS$ 22-Jul-2019 21:35:01.070 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.0j 20 Nov 2018] 22-Jul-2019 21:35:02.135 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 22-Jul-2019 21:35:02.238 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [2,039] milliseconds 22-Jul-2019 21:35:02.433 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 22-Jul-2019 21:35:02.436 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.21] 22-Jul-2019 21:35:02.483 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/GeoWeb.war] 22-Jul-2019 21:35:03.310 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/GeoWeb.$ 22-Jul-2019 21:35:03.313 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/exa$ 22-Jul-2019 21:35:04.211 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps$ 22-Jul-2019 21:35:04.215 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/doc$ 22-Jul-2019 21:35:04.296 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps$ 22-Jul-2019 21:35:04.299 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/ROO$ 22-Jul-2019 21:35:04.380 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps$ 22-Jul-2019 21:35:04.381 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/man$ 22-Jul-2019 21:35:04.477 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps$ 22-Jul-2019 21:35:04.479 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/hos$ 22-Jul-2019 21:35:04.566 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps$ 22-Jul-2019 21:35:04.578 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 22-Jul-2019 21:35:04.626 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 22-Jul-2019 21:35:04.650 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [2,410] milliseconds 23-Jul-2019 04:19:44.330 INFO [http-nio-8080-exec-7] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:415) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:294) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)