Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cert-manager certificate always update when "helm install" command is executed. #4068

Closed
rafaelDev0ps opened this issue May 28, 2021 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@rafaelDev0ps
Copy link

rafaelDev0ps commented May 28, 2021

I already searched in cert-manager docs about this behavior but I not found. I have cert-manager chart in my personal kubernetes configuration repository. The chart version is v1.3.0 and this version is running on my kubernetes cluster.

Bug description:
I have a pipeline integration in this repository and when some configuration is changed all the charts are applied again (including cert-manager chart). When the chart is applied again it updates the certificate (not renew) and the services that uses this certificate stop working.

My current certificate YAML template:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: {{ .Values.certManager.clientCertDbs.secretName }}
  namespace: {{ .Values.certManager.clientCertDbs.namespace }}
spec:
  secretName: {{ .Values.certManager.clientCertDbs.secretName }}
  duration: 2880h # 120d
  renewBefore: 2160h # 90d
  subject:
    organizations:
    - MY_COMPANY
    organizationalUnits:
    - MY_COMPANY
    countries:
    - MY_COUNTRY
    localities: 
    - MY_CITY
    provinces: 
    - MY_PROVINCE
  emailAddresses:
  - blablabla@email.com
  commonName: {{ .Values.certManager.clientCertDbs.commonName }}
  isCA: false
  privateKey:
    algorithm: RSA
    encoding: PKCS1
    size: 2048
  usages:
    - digital signature
    - client auth
  issuerRef:
    name: {{ .Values.certManager.clientCertDbs.issuer }}
    kind: ClusterIssuer
    group: cert-manager.io

Expected behaviour:

Should not update the certificate when run "helm install" command.

Steps to reproduce the bug:
1- Create a certificate using Helm
2- Run "helm install" command again

Anything else we need to know?:
A provisory solution is rollback restart the services that uses the certificate.

Environment details::

  • Kubernetes version: 1.19
  • Cloud-provider/provisioner: Oracle Cloud
  • cert-manager version: 1.3
  • Install method: helm

/kind bug

@jetstack-bot jetstack-bot added the kind/bug Categorizes issue or PR as related to a bug. label May 28, 2021
@irbekrm
Copy link
Contributor

irbekrm commented Jun 10, 2021

Hi, thanks for the issue!

When the chart is applied again it updates the certificate (not renew) and the services that uses this certificate stop working.

Do you mean the X.509 certificate stored in the Secret? Why would the services stop working (assuming a scenario where the Secret is i.e mounted to a pod)?

@rafaelDev0ps
Copy link
Author

Hi @irbekrm, yes I'm using X.509 certificate. I don't know the cause of this behavior, secret is mounted inside the pod. I have Mongo stafefullset with TLS and the other pods that uses certificates also.

I generated two certificates.

  • One CA selfsigned (for Mongo)
  • One certificate (for clients)

Both have the same issuer.

To solve this I have to restart my Statefullset and my Pod.

@irbekrm irbekrm added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Jun 10, 2021
@irbekrm
Copy link
Contributor

irbekrm commented Jun 10, 2021

Thanks for the extra info! We should look into this, but at the moment I don't really know how to reproduce it- if you have any ideas that would be very helpful.

@jetstack-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to jetstack.
/lifecycle stale

@jetstack-bot jetstack-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 16, 2021
@jetstack-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to jetstack.
/lifecycle rotten
/remove-lifecycle stale

@jetstack-bot jetstack-bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 16, 2021
@jetstack-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to jetstack.
/close

@jetstack-bot
Copy link
Contributor

@jetstack-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to jetstack.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ssiegel
Copy link

ssiegel commented May 6, 2023

I had a similar issue, not using helm but the ansible k8s module, which always reported a “changed” state. For me the solution was to specify duration and renewBefore exactly as kubectl get would return it, here for example:

spec:
  duration: 2880h0m0s # 120d
  renewBefore: 2160h0m0s # 90d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

No branches or pull requests

4 participants