Hi, I have a microservices app in GKE, How can i deploy my service through internal load balancer?
(in the ui i have only 3 option - Cluster ip, Node port, Load balancer(external ip))
you can use k8s annotations.
you can create a service of type load balancer then by adding annotations you can achieve this
You won't be able to use the UI to create an internal load balancer. You will actually need to use something like `kubectl` to deploy a Service of type LoadBalancer which specifies that you want an internal LB via annotations.
apiVersion: v1
kind: Service
metadata:
name: ilb-svc
annotations:
networking.gke.io/load-balancer-type: "Internal"
spec:
type: LoadBalancer
externalTrafficPolicy: Cluster
selector:
app: ilb-deployment
ports:
- name: tcp-port
protocol: TCP
port: 8080
targetPort: 8080
See https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing#create for a walkthrough.
Thank you for your answer,
Can you help me with the annotation syntax to get a http(s) internal load balancer ?
(after adding this annotation a got tcp/udp load balancer )
Thank a lot !
The annotation is kubernetes.io/ingress.class: "gce-internal"
Here's a spec for the Internal HTTP Load Balancer:
# internal-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ilb-demo-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: "gce-internal"
spec:
defaultBackend:
service:
name: hostname
port:
number: 80
But unfortunately there are a number of steps you need to take before you can successfully deploy this:
https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balance-ingress#prepare-environ...