how can I debug a 404 on an endpoints deployed to k8s?

567 views
Skip to first unread message

Nick Longinow

unread,
Feb 20, 2019, 11:23:55 AM2/20/19
to Google Cloud Endpoints
I'm getting this error.  How should I debug it?  It's basically the sample application on GCP (echo app) but I changed the url to "alive" instead of "echo".

jsonPayload: {
api_key: "AIzaSyDYuK-MVEPzLPWnvZffrzNZ6bd4zE61FOQ" 
api_method: "1.staff_api_endpoints_micro_228014_cloud_goog.Alive" 
api_name: "1.staff_api_endpoints_micro_228014_cloud_goog" 
api_version: "1.0.2" 
error_cause: "application" 
http_method: "POST" 
http_response_code: 404 
location: "us-central1-a" 
log_message: "Method: 1.staff_api_endpoints_micro_228014_cloud_goog.Alive" 
producer_project_id: "micro-228014" 
request_latency_in_ms: 46 
request_size_in_bytes: 209 
response_size_in_bytes: 971 
timestamp: 1550679220.328291 
url: "/alive?key=AIzaSyDYuK-MVEPzLPWnvZffrzNZ6bd4zE61FOQ" 
}

Rob Wyrick

unread,
Feb 20, 2019, 3:34:28 PM2/20/19
to Nick Longinow, Google Cloud Endpoints
It's difficult to say since you didn't specify what, exactly, you changed.    Based on the 404, I'm guessing the deployed code is not expecting a "/alive" path.
Can you supply more details?
Are you using AppEngine?  AppEngine Flex?  GKE?  etc.
Did you modify the code to look for the "/alive" path?

-Rob


--
You received this message because you are subscribed to the Google Groups "Google Cloud Endpoints" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-endp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-endpoints/c111c2f1-eb1b-413a-80fc-1da167169643%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick Longinow

unread,
Feb 20, 2019, 3:45:09 PM2/20/19
to Rob Wyrick, Google Cloud Endpoints
Thanks Rob.  I'm using GKE.  I'll double check that the /alive path is properly deployed.  
--
-----------------------------------------------------
Nick Longinow
nicklo...@gmail.com




Nick Longinow

unread,
Feb 22, 2019, 11:35:55 AM2/22/19
to Rob Wyrick, Google Cloud Endpoints
Might have figured it out.  The example deploys the "echo" app into a GAE container image. My endpoints run in a Spring Boot container.   

Is this the rule?
--> When deploying GCP Endpoints code into GKE, that endpoints code must live in a GAE container?

------------------------form the echo example code-----------------------

Rob Wyrick

unread,
Feb 22, 2019, 2:05:12 PM2/22/19
to Nick Longinow, Google Cloud Endpoints
The echo app (gcr.io/google-samples/echo-go:latest) that is deployed is a Docker container image.  I'm not sure what you mean by a "Spring boot container".  From what I can tell, I believe that Spring boot containers are also docker containers, so they should work just fine.

-Rob

Rose Davidson

unread,
Feb 22, 2019, 2:24:16 PM2/22/19
to Nick Longinow, Rob Wyrick, Google Cloud Endpoints
If you're referring to https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/endpoints/getting-started/src/main/docker/Dockerfile, then that is a code example for Google App Engine Flexible, yes. Since you're working with Kubernetes, you should probably consult the "Getting started with Cloud Endpoints on Kubernetes" document: https://cloud.google.com/endpoints/docs/openapi/get-started-kubernetes

Nick Longinow

unread,
Feb 22, 2019, 3:03:27 PM2/22/19
to Rose Davidson, Rob Wyrick, Google Cloud Endpoints
If I deploy my endpoints Java code to a GAE image container, it works.  If I deploy the same code to a generic Tomcat container image, it fails to work. 

So, I'm wondering if endpoints functionality must live in a GAE environment (either base container image, or GAE flexible or standard).



For more options, visit https://groups.google.com/d/optout.

Rose Davidson

unread,
Feb 22, 2019, 3:26:11 PM2/22/19
to Nick Longinow, Rob Wyrick, Google Cloud Endpoints
No, it is entirely possible to deploy endpoints backends to Kubernetes or any other arbitrary compute environment, which is why we have tutorials showing how to deploy on Kubernetes.

It may be the case that your "endpoints Java code" is designed to work only on GAE, though; I would have to examine your code to determine this.

Nick Longinow

unread,
Feb 22, 2019, 5:00:41 PM2/22/19
to Rose Davidson, Rob Wyrick, Google Cloud Endpoints
As an experiment, I'll try modifying the example (echo) application to deploy to a Tomcat container instead of GAE base image.  Once I've tried that I'll report back

Rose Davidson

unread,
Feb 22, 2019, 5:06:46 PM2/22/19
to Nick Longinow, Rob Wyrick, Google Cloud Endpoints
If you want to try deploying Endpoints with Kubernetes, I would recommend following our quickstart that shows how to do this: https://cloud.google.com/endpoints/docs/openapi/get-started-kubernetes

Nick Longinow

unread,
Feb 22, 2019, 5:10:00 PM2/22/19
to Rose Davidson, Rob Wyrick, Google Cloud Endpoints
Thanks but that is the example I have been using.  I was able to get it to work as-is, but when I added my own container image (jdk-alpine) holding my spring boot application version of the endpoints, it gives a 404 for the methods. I did notice that the example Dockerfile deploys as so:


FROM gcr.io/google_appengine/jetty9


ADD endpoints-1.0-SNAPSHOT.war $JETTY_BASE/webapps/root.war

ADD . /app

RUN chown jetty:jetty $JETTY_BASE/webapps/root.war



while MINE deploys as so

FROM openjdk:8-jdk-alpine

VOLUME /tmp

COPY target/frontend-0.0.1-SNAPSHOT.jar app.jar

ENV JAVA_OPTS=""

ENTRYPOINT exec java -Dserver.port=8085 -jar /app.jar


wondering if I make mine also deploy with Jetty maybe it will work?

Rose Davidson

unread,
Feb 22, 2019, 5:16:40 PM2/22/19
to Nick Longinow, Rob Wyrick, Google Cloud Endpoints
I doubt Jetty is the problem. Why are you running on port 8085? The quickstart has the echo service running on port 8081. If you wish to change that, you will need to change the backend configuration for the endpoints-runtime container.

Nick Longinow

unread,
Feb 22, 2019, 5:18:16 PM2/22/19
to Rose Davidson, Rob Wyrick, Google Cloud Endpoints
I had tried port 8080 for the ESP container and 8081 for mine, but it had no effect.  I can try that again to see if it works (will also change my Dockerfile)

Rose Davidson

unread,
Feb 22, 2019, 5:20:21 PM2/22/19
to Nick Longinow, Rob Wyrick, Google Cloud Endpoints
You can run the backend container on whatever port you wish; you just have to make sure the hostname and port provided in the --backend argument for the endpoints-runtime container corresponds to a hostname and port on which your service can be reached. When in doubt, verify that the service is actually running on that host and port.

Nick Longinow

unread,
Feb 22, 2019, 5:22:27 PM2/22/19
to Rose Davidson, Rob Wyrick, Google Cloud Endpoints
Thanks - will debug further.  I wish GCP had an API Explorer for endpoints.  So you could trace the call from a UI test window and see it percolate into the backend. 

Nick Longinow

unread,
Feb 25, 2019, 8:46:10 PM2/25/19
to Rose Davidson, Rob Wyrick, Google Cloud Endpoints
I got it to work when I deployed my Spring Boot app as a war and used a jetty container image.  I was following this article: https://cloud.google.com/endpoints/docs/openapi/get-started-kubernetes

article says:
I suggest using:

Rob Wyrick

unread,
Feb 26, 2019, 4:45:08 AM2/26/19
to Nick Longinow, Rose Davidson, Google Cloud Endpoints
Glad to hear you got it working!
-Rob

Nick Longinow

unread,
Feb 26, 2019, 6:21:03 AM2/26/19
to Rob Wyrick, Google Cloud Endpoints, Rose Davidson
sure glad this group exists to ask questions! thanks again 

Nick Longinow

unread,
Mar 1, 2019, 6:02:46 PM3/1/19
to Rob Wyrick, Google Cloud Endpoints, Rose Davidson
Thanks again for your help.  I got it working and published a tutorial that might help others.  

Reply all
Reply to author
Forward
0 new messages