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

一笑奈何 提交于 2021-01-07 02:48:55

问题


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

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/65401658/how-to-add-https-load-balancer-for-an-application-deployed-using-gke

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!