When installing openshift via ansible with a named certificate defined in the ansible hosts file the openshift certs are not created correctly. The cacert for the named cert is being added to /etc/origin/master/ca.crt instead of just /etc/origin/master/ca-bundle.crt. This is causing /etc/origin/master/ca.crt and /etc/origin/master/ca.key to mismatch which results in a failed install with the error: tls: private key does not match public key.
ansible --version
ansible 2.3.0.0
git describe
openshift-ansible-3.6.100-1-25-g1720a52
Openshift installs successfully.
Openshift fails to install due to ca.crt and ca.key not matching.
error: tls: private key does not match public key
@cameron-scrace Could you share your inventory and in particular any certificate related variables?
openshift_master_named_certificates=[{"certfile": "/root/certs/named-server.crt", "keyfile": "/root/certs/named-server.key", "names": ["openshift.companyname.com"], "cafile": "/root/certs/named-ca.crt"}]
openshift_master_overwrite_named_certificates=true
As a work around I waited for the install to fail, then manually edited the generated /etc/origin/master/ca.crt and ran it again.
@cameron-scrace @abutcher it seems that this issue still exists even in openshift 3.11.104.
As a work around I waited for the install to fail,
then manually edited the generated /etc/origin/master/ca.crt and ran it again.
Unfortunately the ansible overwrite the ca.crt each time it's ran.
Please any other workaround ?
Confirmed this is occurring in 3.11.117 as well
Issue still occurs in 3.11.117.
Ran this script this on the masters as a workaround while the installer ran:
#!/bin/bash
bundle=/etc/origin/master/ca-bundle.crt
cert=/etc/origin/master/ca.crt
while true
do
if [[ -f ${bundle} && -f ${cert} ]]
then
bundle_cksum=`cksum ${bundle}|awk '{print $1}'`
cert_cksum=`cksum ${cert}|awk '{print $1}'`
echo "cksums are ${bundle_cksum} ${cert_cksum} "
if [[ ${bundle_cksum} -ne ${cert_cksum} ]]
then
cp ${bundle} ${cert}
fi
fi
sleep 20
done
You have to wait for the initial install to fail before copying the files over each other. Otherwise, you will get an error that only one certificate is expected in ca.crt.
If you have your 'cafile' name as 'ca.crt', please change to something like 'custom_ca.crt'. Because the playbook just copies your named_certificate CA into /etc/origin/master/. If you use the same name as openshift self-signer, it's going to overwrite it.
I can confirm that renaming the 'cafile' to something other than 'ca.crt' fixes the issue. Thanks @arocki7 !
Thanks @arocki7 for the suggestion. I have been troubling myself with this issue for two weeks!
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle rotten
/remove-lifecycle stale
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.
/close
@openshift-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting
/reopen.
Mark the issue as fresh by commenting/remove-lifecycle rotten.
Exclude this issue from closing again by commenting/lifecycle frozen./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.
Most helpful comment
I can confirm that renaming the 'cafile' to something other than 'ca.crt' fixes the issue. Thanks @arocki7 !