【发布时间】:2018-07-05 19:10:54
【问题描述】:
太多的挣扎,我需要分享。
需要:dev_appserverhttps://ip_cluster_/apis/v1/xxx 上的GET/POST(用于本地测试)
错误:Invalid and/or missing SSL certificate for URL
原因:k8s 集群端点使用自动签名证书
尝试:
- 使用 Let's Encrypt 证书和入口。失败,因为 Let's encrypt 需要 DNS
- 要求 AppEngine 进行不安全的连接:全局与
PYTHONHTTPSVERIFY: 0在main.app和本地与validate_certificate=None与url_fetch或verify=False与requests。失败,因为 AppEngine 中不允许使用带有自动签名证书的不安全 SSL 连接。公关:https://github.com/GoogleCloudPlatform/python-compat-runtime/pull/124 - 从
https://container.googleapis.com/v1beta1/projects/<my-gcp-project>/locations/<location>/clusters/<my-cluster>获取证书/密钥,解码base64,写入文件,将它们与cert=('cluster_k8s.cert', 'cluster_k8s.key')中的requests一起使用。失败,因为在 AppEngine 中禁用了本地证书支持。将它们与 curl 一起使用就可以了。很明显。 - 像上面一样获取证书/密钥,并将它们作为自定义证书添加到 google cloud sdk:
gcloud config set core/custom_ca_certs_file=my_cert.pem。失败是因为生活艰难。 - 像上面一样获取证书/密钥并将它们附加到谷歌云 sdk 之一:
cd /usr/lib/google-cloud-sdk/platform/google_appengine/lib/cacerts/ cat my_cert >> urlfetch_cacerts.txt失败是因为生活更加艰难。
【问题讨论】:
标签: google-app-engine kubernetes ssl-certificate google-kubernetes-engine