google-cloud-platform - 使用 Cloud Deployment Manager 上传 SSL 证书
问题描述
我不断尝试,但没有运气。以下是我每次尝试时收到的消息
The fingerprint of the deployment is j6t0HcwFHHQifZteb2l3aA==
Waiting for update [operation-1553685800030-58511aa341085-accaf31f-b8a2d802]...failed.
ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1553685800030-58511aa341085-accaf31f-b8a2d802]: errors:
- code: RESOURCE_ERROR
location: /deployments/infrastructure/resources/lb-ssl-certificate
message: '{"ResourceType":"compute.v1.sslCertificate","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"errors":[{"domain":"global","message":"The
SSL certificate could not be parsed.","reason":"sslCertificateCouldNotParseCert"}],"message":"The
SSL certificate could not be parsed.","statusMessage":"Bad Request","requestPath":"https://www.googleapis.com/compute/v1/projects/xxx/global/sslCertificates","httpMethod":"POST"}}'
下面是我的 jinja 片段 (sslcert-template.jinja)
- name: lb-ssl-certificate
type: compute.v1.sslCertificate
properties:
certificate: example.com.crt
privateKey: example.com.key
请注意example.com.crt和example.com.key与sslcert-template.jinja位于同一位置。我正在使用 docker google/cloud-sdk 来执行此操作。我使用具有项目所有者角色的电子邮件登录
我还尝试了带有证书和密钥的 gcloud,效果很好
gcloud compute ssl-certificates create sample --certificate=example.com.crt --private-key=example.com.key
Created [https://www.googleapis.com/compute/v1/projects/xxx/global/sslCertificates/sample].
NAME CREATION_TIMESTAMP
sample 2019-03-29T20:59:14.371-07:00
经过一些尝试..我尝试在python模板中进行操作,并将实际的证书和密钥作为值定义为多行并且它只是工作
解决方案
发布答案,因为这是截至 2020 年 6 月 Google 中deployment manager ssl certificates
的热门话题,即使在结果列表的下方有答案(但不在 stackoverflow 上)。
部署管理器希望文件内联在 yaml 文件中,而不是作为本地文件的路径。
即,它应该看起来像这样:
- name: ssl-cert
type: compute.v1.sslCertificate
properties:
certificate: |
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIUUVkDsK2nWJtToHzFjukeJzPyKaYwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
...
eDbQMIjIXvZNP6e3D3COn862l+OA/MjWjFVZnaraCpKByc1SBBaD1axQ/MY0jks=
-----END CERTIFICATE-----
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
MIIJpDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIgqbfXwjdaNICAggA
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECCKSeDnJWXINBIIJUHZOCaP6RbbM
...
bru0DNVNlF4pMWzX6QaInsAPJoA63kS+
-----END RSA PRIVATE KEY-----
我不确定是否有办法自动将文本文件内联到 jinja 模板中。
推荐阅读
- c# - ac# Asp.Net 数据集中的数据表包含来自其他数据表的列
- css - 当我的 Angular Material 选项卡处于活动状态而不使用 ::ng-deep 和 viewEncapsulation.none 时,如何更改背景颜色?
- html - 联系表格 7 复选框:如何将它们按垂直顺序排列
- smart-wizard - TypeError: this.nav.find 不是一个函数 smartwizard
- python - 每 60 个元素在一个新列表中分组
- javascript - 使用 JavaScript 循环遍历 Json 文件中的多个数组
- sublimetext3 - 试图忽略 Sublime 中的 flake8 W503 错误,但对用户设置的编辑不会影响它
- amazon-web-services - 使用放大 Auth.currentCredentials() 时出现“配置中缺少凭据”错误
- javascript - 如何将 --max-old-space-size=8192 应用于 Ubuntu 服务
- mysql - 如何获得今天和第二天早上 8 点之间的小时差 - MYSQL