在 GKE 上创建内部 LoadBalancer 服务
To make a LoadBalancer service internal on GKE
您知道我们可以在 GKE 上使用它来在内部创建 LoadBalancer 服务的注解是什么吗?。例如,Azure(和 AWS)支持以下注释(显示在 YAML 代码片段中)以在内部创建 LoadBalancer 服务。我在 GKE 上找不到等效的。例如,人们自然会期望 gcp-load-balancer-internal 作为 GKE 上的等效注释;不幸的是它不是。这是它的 Azure 和 AWS 文档,我正在寻找 GKE 上的等效文档。
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
可以找到等效项 here。
apiVersion: v1
kind: Service
metadata:
name: ilb-service
annotations:
networking.gke.io/load-balancer-type: "Internal"
labels:
app: hello
spec:
type: LoadBalancer
selector:
app: hello
ports:
- port: 80
targetPort: 8080
protocol: TCP
有2个注释:
对于 GKE 1.17 及更高版本,使用注释:
networking.gke.io/load-balancer-type: "Internal"
对于早期版本,使用注释:
cloud.google.com/load-balancer-type: "Internal"
此外,我将在以下网址中与您分享一些 GCP 的有用官方文档 Using an internal TCP/UDP load balancer and Setting up Internal HTTP(S) Load Balancing 。
您知道我们可以在 GKE 上使用它来在内部创建 LoadBalancer 服务的注解是什么吗?。例如,Azure(和 AWS)支持以下注释(显示在 YAML 代码片段中)以在内部创建 LoadBalancer 服务。我在 GKE 上找不到等效的。例如,人们自然会期望 gcp-load-balancer-internal 作为 GKE 上的等效注释;不幸的是它不是。这是它的 Azure 和 AWS 文档,我正在寻找 GKE 上的等效文档。
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
可以找到等效项 here。
apiVersion: v1
kind: Service
metadata:
name: ilb-service
annotations:
networking.gke.io/load-balancer-type: "Internal"
labels:
app: hello
spec:
type: LoadBalancer
selector:
app: hello
ports:
- port: 80
targetPort: 8080
protocol: TCP
有2个注释:
对于 GKE 1.17 及更高版本,使用注释:
networking.gke.io/load-balancer-type: "Internal"
对于早期版本,使用注释:
cloud.google.com/load-balancer-type: "Internal"
此外,我将在以下网址中与您分享一些 GCP 的有用官方文档 Using an internal TCP/UDP load balancer and Setting up Internal HTTP(S) Load Balancing 。