-
Notifications
You must be signed in to change notification settings - Fork 715
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
kubeadm alpha certs renew fails to update CA in conf files #2027
Comments
thanks for the report. i will try to reproduce the problem. |
@abhiTamrakar some notes:
|
/lifecycle active |
Thanks @neolit123 I agree with some of the factors, my opinion inline.
_CA rotation has to be done at some point, if even we consider 10 years. From security point of view we have a mandate to keep Intermediate CA of lesser validity <=1yr. It becomes a hard stop for us. This is a kind of feature even most of the managed providers can't provide. I am not sure how many such organization would be there but one day at least everyone has to rotate CA. There shall also be a documentation clear enough on this context, though._
Agreed, kubeadm or any kubernetes component cannot be blamed, but there's even a calculated security risk by not rotating the CA after some good amount of time..
I guess as long as they are separate entities altogether from the CA certificate, we should be still good. right?
Yes, we have to handle that part in our automation. |
OpenShift does this the way it should be done sequentially (as it is written by the folks who wrote the auth in k8s). it's using the operator pattern and it's quite complex. there was a talk about it at KubeCon some time ago.
kubernetes itself is quite unfriendly to CA rotation. the sequence of the OpenShift operator was quite strict in terms of how/when components are made aware of a rotated CA.
+1, this seems like something that SIG Auth should document and not the kubeadm maintainers.
that is true, the only reason we don't recommend it to users is that they can destroy their cluster and or have long downtimes due to complications. quite frankly, if someone has the infrastructure at their disposal, they can export all workloads and data store, create a new cluster and import the old data. then scrap the old cluster. the "cluster-replace" upgrade pattern is the safest one!
the same argument for CA rotation applies to service account key pair rotation. which makes it "difficult" to rotate, to say the least. |
@neolit123 any place I can raise issue to request to put some documentation around CA rotation? |
the documentation should reside in the k8s.io website. the repository that holds it is https://github.com/kubernetes/website. e.g. on this page: you can create a tracking issue there, tag it with the documentation in question should be deployer (e.g. kubeadm) agnostic. |
@abhiTamrakar |
@neolit123 Yes, I patched it. |
Just because I don't see it mentioned anywhere above, I think the key step in smoothly rotating the cluster CA is to append both the old and the new CA certs to |
technically, the singing cert/key for a KCM trust bundle can be made distinct with an extra flag for the KCM that defaults to a sane order value that the user can control (or maybe the user can also tell it to auto-detect). i think the cert management process is already complicated enough on the user side to have a separate CA file for the KCM that is not a bundle... #1350 feels like more of a KCM issue that has to be first discussed with SIG Auth. somebody did send a PR to support CA bundles across kubeadm here: |
I don't know how far I am correct here with this, still reading through the codebase to understand what all can be done because this is a hard stop for us. As @anguslees mentioned, I did found the ca.key (private key) can have multiple private keys but again the issue in #1350 seems to be coming in the way. I even saw a 2-3 months old PR raised by someone handling CA rotation, lost that link. Ideally for people want to rotate CA there shall be a switch --rotate-ca-certificates kind of which should handle updating all entities with new CA in a rolling fashion. |
@neolit123 is there a possibility of getting it back ported to one of 1.16.x and 1.17.x? Also, ca.crt in service account tokens also doesn't get updated, any way to do that or it has to be manual for now? |
Hi. Sadly no, we only backport critical fixes (e.g panics and security
issues).
Also, yes the service accounts need manual update AFAIK. Sig auth should
confirm.
|
I experienced this recently with a client who was locked out of their cluster despite expecting all certs to renew. They were able to get back in by using the |
Following steps to CA rotation, I have create new CA and at this step "Run kubeadm alpha certs renew one by one for all certificates and conf files with the new CA along with --cert-dir=< temp dir >." I'm running this command like kubeadm alpha certs renew apiserver --cert-dir = /tmp/pki/ to create apiserver certificate. But certificate is not generating in /tmp/pki folder instead it is generating in default (/etc/kubernetes/pki) folder signing with old CA. Please suggest if I'm doing anything wrong |
@ravirajshankarl kubeadm uses existing ca certificates to sign underlying certs, which is why you are seeing certs signed by old CA. |
@abhiTamrakar I have create newCA and placed it in tmp folder to generate certificates. Do I need to keep newCA in /etc/kubernetes/pki folder also? |
I do not remember this being an issue. Might have to try it. If you think it is an issue you might want to open one. Hi, sorry for being late. Answered inline. |
What keywords did you search in kubeadm issues before filing this one?
'kubeadm alpha certs', 'certs renew', 'kubeadm alpha'
Is this a BUG REPORT or FEATURE REQUEST? BUG REPORT
Versions
1.16.4
kubeadm version (use
kubeadm version
): 1.16.4Environment:
kubectl version
): 1.16.4uname -a
): 3.10.0-1062.4.3.el7.x86_64What happened?
kubeadm alpha certs renew <item>
one by one for all certificates and conf files with the new CA in a separate --cert-dir.What you expected to happen?
CONF files must be updated with new CA (base64)content instead of the old CA.
How to reproduce it (as minimally and precisely as possible)?
kubeadm alpha certs renew <item>
one by one for all certificates and conf files with the new CA along with --cert-dir=< temp dir >.awk '/certificate-authority-data:/ {print $2}' admin.conf| base64 -d|openssl x509 -noout -dates
andopenssl x509 -in /etc/kubernetes/pki/ca.crt -noout -dates
Anything else we need to know
not related to #1518, #1361 has some ref but not solution
the problem is updating certs would work as long as one is not updating the CA itself not the other way round.
The text was updated successfully, but these errors were encountered: