Manu Chadha
Manu Chadha

Reputation: 16755

How to add HTTPS load balancer for an application deployed using GKE

I have created a Play web application which is now deployed on GCP. The application works fine. I want to add https support in it to secure communication between the client and the server.

I know that in GCP, there is an option to create http load balancers but I think they are meant for applications running on VMs/Compute instances directly and not via GKE.

Question 1 - Am I correct? I am asking because when I try to configure the load balancer, I don't see reference to my currently deployed application.

Question 2 - For my application which is deployed using GKE on a cluster, how can I add support of https?

My current application is deployed using the following yamls.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: name
spec:
  replicas: 2
  selector:
    matchLabels:
      app: somename

and

apiVersion: v1
kind: Service
metadata:
  name: somename-service
spec:
  selector:
    app: somename
  ports:
    - protocol: TCP
      port: 9000
      targetPort: 9000
  type: LoadBalancer

Upvotes: 1

Views: 970

Answers (2)

guillaume blaquiere
guillaume blaquiere

Reputation: 75990

You can define a GKE ingress to customize your Load Balancer. You can add annotations to customize the type of load balancer that you want, and you can add SSL certificate to serve traffic in HTTPS

Upvotes: 2

Mahboob
Mahboob

Reputation: 1965

Go to Workload > Select your App > deployment details page > Actions > Expose > Service type select Load Balancer and clicking expose will create LB for your application, using this GUI you can add Load Balancer to your GKE workload easily.

Upvotes: 3

Related Questions