问题
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 VM
s/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 yaml
s.
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