如何为使用GKE部署的应用程序添加HTTPS负载平衡器 [英] How to add HTTPS load balancer for an application deployed using GKE
问题描述
我创建了一个 Play
Web应用程序,该应用程序现在已部署在 GCP
上.该应用程序工作正常.我想在其中添加 https
支持,以保护客户端和服务器之间的通信.
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.
我知道在 GCP
中,可以选择创建 http负载均衡器
,但是我认为它们适用于在 VM
上运行的应用程序s/Compute实例,而不是通过 GKE
直接实现.
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
.
问题1-我正确吗?我之所以问是因为,当我尝试配置负载平衡器时,没有看到对我当前部署的应用程序的引用.
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.
问题2-对于使用 GKE
在群集上部署的应用程序,我如何添加对 https
的支持?
Question 2 - For my application which is deployed using GKE
on a cluster, how can I add support of https
?
我的当前应用程序是使用以下 yaml
s部署的.
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
和
apiVersion: v1
kind: Service
metadata:
name: somename-service
spec:
selector:
app: somename
ports:
- protocol: TCP
port: 9000
targetPort: 9000
type: LoadBalancer
推荐答案
转到工作负载>选择您的应用>部署详细信息页面>动作>曝光>服务类型选择负载平衡器",然后单击公开"将为您的应用程序创建LB,使用此GUI,您可以轻松地将负载平衡器添加到GKE工作负载中.
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.
这篇关于如何为使用GKE部署的应用程序添加HTTPS负载平衡器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!