Plugging in External CA Key and Certificate
This task shows how operators can configure Citadel with existing root certificate, signing certificate and key.
By default, Citadel generates self-signed root certificate and key, and uses them to sign the workload certificates. Citadel can also use the operator-specified certificate and key to sign workload certificates, with operator-specified root certificate. This task demonstrates an example to plug certificates and key into Citadel.
Before you begin
Follow the Istio installation guide1 to install Istio with mutual TLS enabled.
Plugging in the existing certificate and key
Suppose we want to have Citadel use the existing signing (CA) certificate ca-cert.pem
and key ca-key.pem
.
Furthermore, the certificate ca-cert.pem
is signed by the root certificate root-cert.pem
.
We would like to use root-cert.pem
as the root certificate for Istio workloads.
In the following example,
Citadel’s signing (CA) certificate (ca-cert.pem
) is different from root certificate (root-cert.pem
),
so the workload cannot validate the workload certificates directly from the root certificate.
The workload needs a cert-chain.pem
file to specify the chain of trust,
which should include the certificates of all the intermediate CAs between the workloads and the root CA.
In our example, it contains Citadel’s signing certificate, so cert-chain.pem
is the same as ca-cert.pem
.
Note that if your ca-cert.pem
is the same as root-cert.pem
, the cert-chain.pem
file should be empty.
These files are ready to use in the samples/certs/
directory.
The following steps enable plugging in the certificates and key into Citadel:
Create a secret
cacert
including all the input filesca-cert.pem
,ca-key.pem
,root-cert.pem
andcert-chain.pem
:Redeploy Citadel with
global.mtls.enabled
set totrue
andsecurity.selfSigned
tofalse
. Citadel will read certificates and key from the secret-mount files.To make sure the workloads obtain the new certificates promptly, delete the secrets generated by Citadel (named as
istio.\*
). In this example,istio.default
. Citadel will issue new certificates for the workloads.
Verifying the new certificates
In this section, we verify that the new workload certificates and root certificates are propagated.
This requires you have openssl
installed on your machine.
Deploy the Bookinfo application following the instructions3.
Retrieve the mounted certificates. In the following, we take the ratings pod as an example, and verify the certificates mounted on the pod.
Set the pod name to
RATINGSPOD
:Run the following commands to retrieve the certificates mounted on the proxy:
The file
/tmp/pod-root-cert.pem
contains the root certificate propagated to the pod.The file
/tmp/pod-cert-chain.pem
contains the workload certificate and the CA certificate propagated to the pod.Verify the root certificate is the same as the one specified by operator:
Expect the output to be empty.
Verify the CA certificate is the same as the one specified by operator:
Expect the output to be empty.
Verify the certificate chain from the root certificate to the workload certificate:
Cleanup
To remove the secret
cacerts
and redeploy Citadel with self-signed root certificate:To remove the Istio components: follow the uninstall instructions to remove.