Jinja HTTPS负载平衡器的SSL问题-Google Cloud

时间:2019-03-02 13:40:13

标签: google-cloud-platform ssl-certificate jinja2 load-balancing google-deployment-manager

我已经能够将此负载平衡器部署为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

对此有任何帮助!

1 个答案:

答案 0 :(得分:0)

sslCertificates是一组网址。

要确定SSL证书的网址,请按照以下步骤操作。

获取SSL证书列表:

int age;
        Console.WriteLine("How old are you?");

        age = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("You are {0} years old", age);

获取SSL证书的详细信息:

gcloud compute ssl-certificates list

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

gcloud compute ssl-certificates describe NAME