gpt4 book ai didi

kubernetes - 使用云 dns 在 GKE 上配置证书管理器

转载 作者:行者123 更新时间:2023-12-02 11:38:46 25 4
gpt4 key购买 nike

因此,我希望使用 google clouddns 在 GKE 上设置证书管理器。似乎很多关于 SO 的旧问题都在使用 http01 而不是 dns01。我想确保一切都是正确的,这样我就不会受到速率限制。
这是我的 issuer.yaml

apiVersion: cert-manager.io/v1alpha2
kind: Issuer
metadata:
name: letsencrypt-staging
spec:
acme:
server: https://acme-staging-v02.api.letsencrypt.org/directory
email: engineering@company.com
privateKeySecretRef:
name: letsencrypt-staging
solvers:
- dns01:
clouddns:
project: MY-GCP_PROJECT
# This is the secret used to access the service account
serviceAccountSecretRef:
name: clouddns-dns01-solver-svc-acct
key: key.json
这是我的 certificate.yaml
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
name: my-website
namespace: default
spec:
secretName: my-website-tls
issuerRef:
# The issuer created previously
name: letsencrypt-staging
dnsNames:
- my.website.com
我运行这些命令来配置所有内容:
kubectx my-cluster
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.15.1/cert-manager.yaml
kubectl get pods --namespace cert-manager
gcloud iam service-accounts create dns01-solver --display-name "dns01-solver"
gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:dns01-solver@$PROJECT_ID.iam.gserviceaccount.com --role roles/dns.admin
gcloud iam service-accounts keys create key.json --iam-account dns01-solver@$PROJECT_ID.iam.gserviceaccount.com
kubectl create secret generic clouddns-dns01-solver-svc-acct --from-file=key.json
kubectl apply -f issuer.yaml
kubectl apply -f certificate.yaml
这是 kubectl describe certificaterequests 的输出
Name:         my-certificaterequests
Namespace: default
Labels: <none>
Annotations: cert-manager.io/certificate-name: my-website
cert-manager.io/private-key-secret-name: my-website-tls
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"cert-manager.io/v1alpha2","kind":"Certificate","metadata":{"annotations":{},"name":"my-cluster","namespace":"default...
API Version: cert-manager.io/v1alpha3
Kind: CertificateRequest
Metadata:
Creation Timestamp: 2020-06-28T00:05:55Z
Generation: 1
Owner References:
API Version: cert-manager.io/v1alpha2
Block Owner Deletion: true
Controller: true
Kind: Certificate
Name: my-cluster
UID: 81efe2fd-5f58-4c84-ba25-dd9bc63b032a
Resource Version: 192470614
Self Link: /apis/cert-manager.io/v1alpha3/namespaces/default/certificaterequests/my-certificaterequests
UID: 8a0c3e2d-c48e-4cda-9c70-b8dcfe94f14c
Spec:
Csr: ...
Issuer Ref:
Name: letsencrypt-staging
Status:
Certificate: ...
Conditions:
Last Transition Time: 2020-06-28T00:07:51Z
Message: Certificate fetched from issuer successfully
Reason: Issued
Status: True
Type: Ready
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal OrderCreated 16m cert-manager Created Order resource default/my-certificaterequests-484284207
Normal CertificateIssued 14m cert-manager Certificate fetched from issuer successfully
我看到了 secret kubectl get secret my-website-tls
NAME                    TYPE                DATA   AGE
my-website-tls kubernetes.io/tls 3 18m
这是否意味着一切正常,我应该在 prod 中尝试一下吗?让我担心的是,我在云控制台中没有看到任何 DNS 记录更改。
另外我想确认:
  • 我如何将证书更改为通配符 *.company.com ?
  • 如果实际上我已准备好进行生产并且将获得证书,我只需要在我的入口部署中更新 secret 名称即可重新部署?

  • 任何见解将不胜感激。谢谢

    最佳答案

    我已经在 Slack 上回答了你。您可以通过更改 dnsNames 中的值来更改名称。证书部分或 spec.tls.*.hosts如果使用 ingress-shim,您只需包含与您显示的完全相同的通配符名称。

    关于kubernetes - 使用云 dns 在 GKE 上配置证书管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62617729/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com