大网数据广告活动
服务器运维问答

GCP load-balancer ssl certificate resets itself after change

· 52CE 我爱测

So I need to change an expired SSL certificate. Unfortunately, the one responsible for this task has passed away suddenly. I have no experience with google cloud, kuberneted or ingress. If I go to the google cloud console, to loa…

问题原文

原帖链接 · Dawg · CC BY-SA 4.0

So I need to change an expired SSL certificate. Unfortunately, the one responsible for this task has passed away suddenly. I have no experience with google cloud, kuberneted or ingress.

If I go to the google cloud console, to load balancers and click on the only one shown, it shows the certificate named "k8s-ssl-xyz" which is the expired one I need to change. I tried editing this load balancer, under frontend-settings and creating a new certificate. That worked, but after a few minutes it reverts itself back to the old certificate.

Under kubernetes engine, services and ingress there is a service called "basic-ingress4". It's yaml file contains a line stating:

ingress.kubernetes.io/ssl-cert: k8s-ssl-xyz

I tried changing "k8s-ssl-xyz" to the name of the certificate I created earlier, but it also gets reversed to the old one after a while.

gcloud beta compute ssl-certificates list

Returns:

NAME            TYPE   CREATION_TIMESTAMP    EXPIRE_TIME      MANAGED_STATUS
k8s-ssl-xyz                  2019-10-01          2019-08-15
newcert         MANAGED     2019-09-30          2019-12-29        ACTIVE
    x.yz.de: ACTIVE

I also tried

gcloud compute target-https-proxies update k8s-tps-xyz --ssl-certificates newcert

And it returned "Updated [...]" but it didn't work either.

Basically, I am lost here. How can I change this certificate without it resetting itself?

已采纳解答

原帖链接 · Dawg · CC BY-SA 4.0

I worked it out. The basic-ingress4 service had an entry in it's yaml called 'spec->tls->secretName'. Running the command kubectl get secrets returned a secret with this name. kubectl describe secret/secretname returned it was indeed a tls secret for the host I wanted to change the secret for.

So by doing

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/tls.key -out /tmp/tls.crt -subj "/CN=foo.bar.com"

followed by

kubectl create secret tls foo-secret --key /tmp/tls.key --cert /tmp/tls.crt

I created a new secret containing a new certificate. Changing the secretName key in the yaml file to the new name of the secret foo-secret finally changed the certificate for good.

/E: If one wants to use a google managed certificate, removing the 'secretName' entry and changing the load balancer to a google managed certificate works.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-10-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。