带代理协议的GCP TCP负载平衡器

发布于 2025-02-05 10:55:02 字数 777 浏览 3 评论 0 原文

我正在尝试弄清楚如何在GKE中启用代理协议标题。

通常,您可以使用gcloud:

gcloud compute target-ssl-proxies update my-ssl-lb-target-proxy \
    --proxy-header=PROXY_V1

但GKE并未将其列出为注释:

https://cloud.google.com/kubernetes-engine/docs/docs/how-to/service-to/service-parameters

没有任何支持吗? :(

谢谢

I am trying to figure out how to enable the proxy protocol header in GKE.

Usually, you can do it with gcloud:

gcloud compute target-ssl-proxies update my-ssl-lb-target-proxy \
    --proxy-header=PROXY_V1

https://cloud.google.com/load-balancing/docs/tcp/setting-up-tcp#update_proxy_protocol_header_for_target_tcp_proxy

But GKE doesn't list it up as annotation:

https://cloud.google.com/kubernetes-engine/docs/how-to/service-parameters

Isn't there any support yet? :(

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉月流沐 2025-02-12 10:55:02

当您在GKE中创建类型“ LoadBalancer”的服务时,它使用 noflowl noreferrer“> network load load load allancer < /a>用于外部服务和内部tcp/udp load load Balancer 服务。

您也可以使用TCP和/或SSL代理负载平衡器,但涉及一些手动配置。您将需要创建

要创建独立的neg,您可以创建类型clusterip的服务并使用一个neg注释:

apiVersion: v1
kind: Service
metadata:
  name: neg-demo-svc
  annotations:
    cloud.google.com/neg: '{"exposed_ports": {"80":{"name": "NEG_NAME"}}}'
spec:
  type: ClusterIP
  selector:
    run: neg-demo-app # Selects Pods labelled run: neg-demo-app
  ports:
  - port: 80
    protocol: TCP
    targetPort: 9376

然后,您将neg与TCP或SSL代理LB使用的后端服务相关联,例如

gcloud compute backend-services add-backend my-bes \
    --global \
    --network-endpoint-group=NEG_NAME
    ...

When you create a Service of type "LoadBalancer" in GKE, it uses a Network Load Balancer for external services and an Internal TCP/UDP Load Balancer for internal services.

You can use TCP and/or SSL Proxy load balancers as well, but it involves a bit of manual configuration. You will need to create a Standalone NEG and then associate that as the backend of a TCP or SSL Proxy LB.

To create a Standalone NEG, you create a Service of type ClusterIP and use a neg annotation:

apiVersion: v1
kind: Service
metadata:
  name: neg-demo-svc
  annotations:
    cloud.google.com/neg: '{"exposed_ports": {"80":{"name": "NEG_NAME"}}}'
spec:
  type: ClusterIP
  selector:
    run: neg-demo-app # Selects Pods labelled run: neg-demo-app
  ports:
  - port: 80
    protocol: TCP
    targetPort: 9376

You'd then associate the NEG with the backend service used by your TCP or SSL Proxy LB, for example

gcloud compute backend-services add-backend my-bes \
    --global \
    --network-endpoint-group=NEG_NAME
    ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文