1

我已经能够将此负载平衡器部署为 HTTP 负载平衡器,现在正尝试将其部署为 HTTPS 负载平衡器。我正在 Google Cloud 上使用 .JUNJA 和 .YAML 尝试此操作。

我不断收到错误:Invalid value for field 'resource.sslCertificates[0]': 'www.example.com'. The\\ URL is malformed.

resources:
  - name: web-lb-hc #Create a health check for the backend
    type: compute.v1.httpsHealthCheck
    properties:
      port: 443
      requestPath: /

  - name: web-url-map #Required to map url to backend
    type: compute.v1.urlMap
    properties:
      defaultService: $(ref.backend.selfLink)

  - name: backend
    type: compute.v1.backendService #Deployment of backend for VM's 
    properties:
      port: 443
      portName: https
      protocol: HTTPS #Defeined HTTP port for communication with backends
      backends:
      - name: backend
        balancingMode: UTILIZATION
        capacityScaler: 1.0
        group: $(ref.web-ins-group.selfLink)
      maxUtilization: 0.8
      connectionDraining:
        drainingTimeoutSec: 300
      healthChecks: 
      - $(ref.web-lb-hc.selfLink)

  - name: web-http-proxy
    type: compute.v1.targetHttpsProxy
    properties:
      urlMap: $(ref.web-url-map.selfLink)
      sslCertificates: ["www.example.com"]
  - name: web-ipaddress
    type: compute.v1.globalAddress

  - name: web-http-forwardingrule #Creation of forwarding rule 
    type: compute.v1.globalForwardingRule
    properties:
      target: $(ref.web-http-proxy.selfLink)
      IPAddress: $(ref.web-ipaddress.address)
      IPProtocol: TCP #Chosen protocol
      portRange: 443-443

对此的任何帮助将不胜感激!

4

1 回答 1

1

sslCertificates 是一个 url 数组。

要确定 SSL 证书的 URL,请执行以下步骤。

获取 SSL 证书列表:

gcloud compute ssl-certificates list

获取 SSL 证书的详细信息:

gcloud compute ssl-certificates describe NAME

在底部附近的返回数据中查找 selfLink。这是您要使用的值。该值将如下所示:

https://www.googleapis.com/compute/v1/projects/development/global/sslCertificates/production-lb
于 2019-03-02T20:56:15.523 回答