2017-10-10 135 views
1

我无法在线查找有关如何在Gcloud端点中运行多个端点的信息。是否可以通过一个Gcloud可扩展服务器代理服务多个端点

在Gcloud端点例子中,只描述了如何设置,供应1个端点的ESP,我设法得到它的工作

spec: 
    containers: 
    - name: esp 
    image: gcr.io/endpoints-release/endpoints-runtime:1 
    args: [ 
     "-P", "9000", 
     "-s", "SERVICE_NAME", 
     "-v", "SERVICE_CONFIG_ID", 
     "-a", "grpc://127.0.0.1:8000" 
    ] 
    ports: 
     - containerPort: 9000 
    - name: bookstore 
    image: gcr.io/endpointsv2/python-grpc-bookstore-server:1 
    ports: 
     - containerPort: 8000 

我打开4个GRPC端点的容器。 我尝试了以下配置:但它似乎没有按预期工作。 容器:

- name: platform 
    image: gcr.io/platform-100007/platform:latest 
    ports: 
     - containerPort: 8002 
     - containerPort: 8005 
     - containerPort: 8011 
     - containerPort: 8008 

    - name: esp 
    image: gcr.io/endpoints-release/endpoints-runtime:1 
    args: [ 
     "-P", "9005", 
     "-a", "grpc://127.0.0.1:8005", 
     "-P", "9002", 
     "-a", "grpc://127.0.0.1:8002", 
     "-P", "9011", 
     "-a", "grpc://127.0.0.1:8011", 
     "-P", "9008", 
     "-a", "grpc://127.0.0.1:8008", 
     "-s", "testgrpc.endpoints.platform-100007.cloud.goog", 
     "-v", "2017-10-09r0", 
    ] 
    ports: 
     - containerPort: 9005 
     - containerPort: 9002 
     - containerPort: 9011 
     - containerPort: 9008 

服务:

apiVersion: v1 
kind: Service 
metadata: 
    name: platform 
spec: 
    type: LoadBalancer 
    ports: 

    - protocol: TCP 
     port: 9002 
     nodePort: 30082 
     name: "grpc" 

    - protocol: TCP 
     port: 9005 
     nodePort: 30085 
     name: "8005" 

    - protocol: TCP 
     port: 9011 
     nodePort: 30811 
     name: "8011" 

    - protocol: TCP 
     port: 9008 
     nodePort: 30808 
     name: "flow" 

    selector: 
    run: platform 

当我看到[启动] [1]的选择https://cloud.google.com/endpoints/docs/grpc/specify-proxy-startup-options

例如-P HTTP2_PORT --http2_port HTTP2_PORT Sets the ports to be exposed by the proxy for HTTP/2 connections.

因为它在这里使用ports所以我认为它必须是一种配置代理服务多个后端服务的方式,但是我找不到任何相关文档。

回答

0

不明白为什么你需要在4个不同的端口上运行你的服务。即使你有多个gRPC服务,它们也可以在同一个端口上运行。如果要进行负载平衡,则容器或吊舱不适合进行负载平衡。你应该创建更多的豆荚。 好吧,ESP不支持这种负载均衡功能,不支持多个端点。

顺便说一句,这里是source code设置ESP。

相关问题