Extending Self-Signed Certificate Lifetime

Istio self-signed certificates have historically had a 1 year default lifetime. If you are using Istio self-signed certificates, you need to be mindful about the expiration date of the root certificate. The expiration of a root certificate may lead to an unexpected cluster-wide outage.

To evaluate the lifetime remaining for your root certificate, please refer to the first step in the procedure below.

The steps below show you how to transition to a new root certificate. After the transition, the new root certificate has a 10 year lifetime. Note that the Envoy instances will be hot restarted to reload the new root certificates, which may impact long-lived connections. For details about the impact and how Envoy hot restart works, please refer to here and here.

Scenarios

If you are not currently using the mutual TLS feature in Istio and will not use it in the future, you are not affected and no action is required.

If you may use the mutual TLS feature in the future, you should follow the procedure below to perform a root certificate transition.

If you are currently using the mutual TLS feature in Istio with self-signed certificates, please follow the procedure and check whether you will be affected.

Root transition procedure

  1. Check when the root certificate expires:

    Download this script on a machine that has kubectl access to the cluster.

    1. $ wget https://raw.githubusercontent.com/istio/tools/release-1.7/bin/root-transition.sh
    2. $ chmod +x root-transition.sh
    3. $ ./root-transition.sh check-root
    4. ...
    5. =====YOU HAVE 30 DAYS BEFORE THE ROOT CERT EXPIRES!=====

    Execute the remainder of the steps prior to root certificate expiration to avoid system outages.

  2. Check the version of your sidecars and upgrade if needed:

    Some early versions of Istio sidecar could not automatically reload the new root certificate. Please run the following command to check the version of your Istio sidecars.

    1. $ ./root-transition.sh check-version
    2. Checking namespace: default
    3. Istio proxy version: 1.3.5
    4. Checking namespace: istio-system
    5. Istio proxy version: 1.3.5
    6. Istio proxy version: 1.3.5
    7. ...

    If your sidecars are using versions lower than 1.0.8 and 1.1.8, please upgrade the Istio control plane and sidecars to versions no lower than 1.0.8 and 1.1.8. To upgrade, follow the Istio upgrade procedure or the procedure provided by your cloud service provider.

  3. Execute a root certificate transition:

    During the transition, the Envoy sidecars may be hot-restarted to reload the new certificates. This may have some impact on your traffic. Please refer to Envoy hot restart and read this blog post for more details.

    If your Pilot does not have an Envoy sidecar, consider installing one. Pilot has issues using the old root certificate to verify the new workload certificates, which may cause disconnection between Pilot and Envoy. Please see here for how to check for this condition. The Istio upgrade guide by default installs Pilot with a sidecar.

    1. $ ./root-transition.sh root-transition
    2. Create new ca cert, with trust domain as cluster.local
    3. Wed Jun 5 19:11:15 PDT 2019 delete old ca secret
    4. secret "istio-ca-secret" deleted
    5. Wed Jun 5 19:11:15 PDT 2019 create new ca secret
    6. secret/istio-ca-secret created
    7. pod "istio-citadel-8574b88bcd-j7v2d" deleted
    8. Wed Jun 5 19:11:18 PDT 2019 restarted Citadel, checking status
    9. NAME READY STATUS RESTARTS AGE
    10. istio-citadel-8574b88bcd-l2g74 1/1 Running 0 3s
    11. New root certificate:
    12. Certificate:
    13. Data:
    14. ...
    15. Validity
    16. Not Before: Jun 6 03:24:43 2019 GMT
    17. Not After : Jun 3 03:24:43 2029 GMT
    18. Subject: O = cluster.local
    19. ...
    20. Your old certificate is stored as old-ca-cert.pem, and your private key is stored as ca-key.pem
    21. Please save them safely and privately.
  4. Verify the new workload certificates are generated:

    1. $ ./root-transition.sh verify-certs
    2. ...
    3. Checking the current root CA certificate is propagated to all the Istio-managed workload secrets in the cluster.
    4. Root cert MD5 is 8fa8229ab89122edba73706e49a55e4c
    5. Checking namespace: default
    6. Secret default.istio.default matches current root.
    7. Secret default.istio.sleep matches current root.
    8. Checking namespace: istio-system
    9. Secret istio-system.istio.default matches current root.
    10. ...
    11. =====All Istio mutual TLS keys and certificates match the current root!=====

    If this command fails, wait a minute and run the command again. It takes some time for Citadel to propagate the certificates.

  5. Verify the new workload certificates are loaded by Envoy:

    You can verify whether an Envoy has received the new certificates. The following command shows an example to check the Envoy’s certificate for a pod.

    1. $ kubectl exec [YOUR_POD] -c istio-proxy -n [YOUR_NAMESPACE] -- curl http://localhost:15000/certs | head -c 1000
    2. {
    3. "certificates": [
    4. {
    5. "ca_cert": [
    6. ...
    7. "valid_from": "2019-06-06T03:24:43Z",
    8. "expiration_time": ...
    9. ],
    10. "cert_chain": [
    11. {
    12. ...
    13. }

    Please inspect the valid\_from value of the ca\_cert. If it matches the _Not_ _Before_ value in the new certificate as shown in Step 3, your Envoy has loaded the new root certificate.

Troubleshooting

Why aren’t workloads picking up the new certificates (in Step 5)?

Please make sure you have updated to 1.0.8, 1.1.8 or later for the istio-proxy sidecars in Step 2.

If you are using Istio releases 1.1.3 - 1.1.7, the Envoy may not be hot-restarted after the new certificates are generated.

Why does Pilot not work and log “handshake error”?

This may because Pilot is not using an Envoy sidecar, while the controlPlaneSecurity is enabled. In this case, restart both Galley and Pilot to ensure they load the new certificates. As an example, the following commands redeploy a pod for Galley / Pilot by removing a pod.

  1. $ kubectl delete po <galley-pod> -n istio-system
  2. $ kubectl delete po <pilot-pod> -n istio-system

How can I check if Pilot has a sidecar?

If the following command shows 1/1, that means your Pilot does not have an Envoy sidecar, otherwise, if it is showing 2/2, your Pilot is using an Envoy sidecar.

  1. $ kubectl get po -l istio=pilot -n istio-system
  2. istio-pilot-569bc6d9c-tfwjr 1/1 Running 0 11m

Why can’t I deploy new workloads with the sidecar-injector?

This may happen if you did not upgrade to 1.0.8, 1.1.8 or later. Try to restart the sidecar injector. The sidecar injector will reload the certificate after the restart:

  1. $ kubectl delete po -l istio=sidecar-injector -n istio-system
  2. pod "istio-sidecar-injector-788bd8fc48-x9gdc" deleted

See also

Extending Istio Self-Signed Root Certificate Lifetime

Learn how to extend the lifetime of Istio self-signed root certificate.

Change in Secret Discovery Service in Istio 1.3

Taking advantage of Kubernetes trustworthy JWTs to issue certificates for workload instances more securely.

Istio DNS Certificate Management

Shows how to provision and manage DNS certificates in Istio.

Provision a certificate and key for an application without sidecars

A mechanism to acquire and share an application certificate and key through mounted files.

Istio in 2020 - Following the Trade Winds

A vision statement and roadmap for Istio in 2020.

Remove cross-pod unix domain sockets

A more secure way to manage secrets.