Home > front end >  To make a LoadBalancer service internal on GKE
To make a LoadBalancer service internal on GKE

Time:12-09

Do you know what is the annotation that we can use it on GKE to make a LoadBalancer service internal?. For example Azure (and AWS) supports the following annotation (shown in the YAML code snippet) to make a LoadBalancer service internal. I couldn’t find equivalent of it on GKE. For example naturally one may expect gcp-load-balancer-internal as the equivalent annotation on GKE; unfortunately it is not. Here is the Azure and AWS documentation for it, I am looking equivalent of it on GKE.

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: "true"
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"

CodePudding user response:

The equivalent can be found here.

apiVersion: v1
kind: Service
metadata:
  name: ilb-service
  annotations:
    networking.gke.io/load-balancer-type: "Internal"
  labels:
    app: hello
spec:
  type: LoadBalancer
  selector:
    app: hello
  ports:
  - port: 80
    targetPort: 8080
    protocol: TCP

CodePudding user response:

There are 2 annotations:

For GKE versions 1.17 and later, use the annotation:

networking.gke.io/load-balancer-type: "Internal"

For earlier versions, use the annotation:

cloud.google.com/load-balancer-type: "Internal"

Plus, I’m sharing with you some GCP’s helpful official documentation in the following URLs Using an internal TCP/UDP load balancer and Setting up Internal HTTP(S) Load Balancing .

  • Related