google-app-engineelasticsearchgoogle-kubernetes-engineinternal-load-balancer

GCP internal load balancer


I'm trying access elasticsearch cluster on GKE from my project in GAE - flexible. Since I don't want an external load-balancer, I'm following this guide: https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing Both GKE and GAE are deployed in the same region, but the calls to the elasticsearch cluster timeout all the time. Has anyone done this and can share some tips would be much appreciated!

My service.yaml file looks like this:

apiVersion: v1
kind: Service
metadata:
  name: internalloadbalancerservice
  annotations:
    cloud.google.com/load-balancer-type: "Internal"
  labels:
    app.kubernetes.io/component: elasticsearch-server
    app.kubernetes.io/name: elasticsearch  #label selector service
spec:
  type: LoadBalancer
  loadBalancerSourceRanges:   # restrict access
  - xxxxxxxx
  ports:
  - name: myport
    port: 9000
    protocol: TCP # default; can also specify UDP
  selector:
    app.kubernetes.io/name : elasticsearch # label selector for Pods
    app.kubernetes.io/component: elasticsearch-server

Solution

  • To save anyone else from a similar situation, I will share my findings of why I couldn't connect to my GKE app from GAE. The GAE was in region europe-west, while GKE was in region europe-west-4a. I thought that would be the same region. But changing GKE region to europe-west-1b worked. Not very obvious but when reading the documentation GAE region europe-west and GKE region europe-west-1b are both in Belgium.