This document presents troubleshooting techniques for Endpoints deployments on Google Kubernetes Engine (GKE) and Kubernetes.
Failed in kubectl create -f gke.yaml
If you see the Failed in kubectl create -f gke.yaml error message, take the
following steps:
- Authorize - gcloud:- gcloud auth login gcloud auth application-default login
- Create a cluster. You can either use the following - gcloudcommand, or create a cluster using Google Cloud console.- gcloud container clusters create CLUSTER_NAME - Replace - CLUSTER_NAMEwith your cluster's name.
- Get credentials for your cluster and make them available to - kubectl:- gcloud container clusters get-credentials CLUSTER_NAME 
Endpoints metrics and logs aren't displayed
If you can successfully send requests to your API, but you don't see any metrics or logs on the Endpoints > Services page in the Google Cloud console, take the following steps:
- Check all the required services are enabled.
- Check all the required permissions are granted.
Accessing logs from Extensible Service Proxy
If you need to access the Extensible Service Proxy (ESP) logs to diagnose
problems, use kubectl as follows:
- Get the name of the pod: - kubectl get pod NAME READY STATUS RESTARTS AGE esp-echo-174578890-x09gl 2/2 Running 2 21s- The pod name is - esp-echo-174578890-x09gland it has two containers:- espand- echo.
- To view the logs in a pod use - kubectl logs:- kubectl logs POD_NAME -c CONTAINER_NAME - Where - POD_NAMEand- CONTAINER_NAMEare returned from the- kubectl get podcommand, in the previous step. For example:- kubectl logs esp-echo-174578890-x09gl -c esp
Verifying the service name
If you see the error messageFetching service config failed, verify that the
service name that you specified in the --service field in your Deployment
manifest file (referred to as the deployment.yaml file) matches the name in the
host field in your OpenAPI document (referred to as the openapi.yaml file).
If the incorrect name is in the deployment.yaml file:
- Open the - deployment.yamlfile and go to the section configured for the ESP container. For example:- containers: - name: esp image: gcr.io/endpoints-release/endpoints-runtime:1 args: [ "--http_port=8081", "--backend=127.0.0.1:8080", "--service=SERVICE_NAME", "--rollout_strategy=managed" ]- Change - SERVICE_NAMEso that it matches the name in the- hostfield in the- openapi.yamland save the- deployment.yamlfile.
- Start the Kubernetes service: - kubectl create -f deployment.yaml
If the incorrect name is in the openapi.yaml file:
- Get the service name that Endpoints was configured to use. 
- Delete the service: - gcloud endpoints services delete SERVICE_NAME - Replace - SERVICE_NAMEwith the name from the previous step. It takes 30 days for the service to be deleted from Google Cloud. You aren't able to reuse the service name during this time.
- Open the - openapi.yamlfile and correct the name in the- hostfield and save the file.
- Deploy the updated service configuration: - gcloud endpoints services deploy openapi.yaml
- Wait for the service configuration to be successfully deployed. 
- Start the Kubernetes service: - kubectl create -f deployment.yaml
Checking configuration files
- Use - sshto connect to the pod using- kubectl:- kubectl exec -ti -c CONTAINER_NAME POD_NAME bash - Replace - CONTAINER_NAMEwith the name of your container and- POD_NAME with the name of your pod. 
- In the - etc/nginx/endpoints/directory, check the following configuration files for errors:- nginx.conf- The- nginxconfig file with ESP directives
- service.jso- The service configuration file
 
Accessing the Endpoints status page
If you set rollout_strategy to managed when you started ESP,
and you need to find out the configuration ID that an instance of
ESP is using, the Endpoints status page has the information.
To access the Endpoints status page:
- Use - sshto connect to the pod using- kubectl:- kubectl exec -ti -c CONTAINER_NAME POD_NAME bash - Replace - CONTAINER_NAMEwith the name of your container and- POD_NAMEwith the name of your pod.
- Install - curl.
- Enter the following: - curl http://localhost:8090/endpoints_status- It displays something similar the following: - "serviceConfigRollouts": { "rolloutId": "2017-08-09r27", "percentages": { "2017-08-09r26": "100" } }
The value in the rolloutId is the service configuration ID that
ESP is using. To make sure that ESP is using the
same configuration as Endpoints,
see
Getting the service name and configuration ID.