Google Distributed Cloud (GDC) air-gapped provides a [public key infrastructure (PKI) API](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/apis/service/security/pki/v1/security-pki-v1)
to get web certificates. This document provides instructions to change the
default certificate issuer to another issuer. For more information about PKI
certificate modes, see [Web TLS certificate configuration](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/platform/pa-user/pki/web-tls-cert-config).

This document is for audiences within the platform administrator group who want
to manage certificate issuers. For more information, see
[Audiences for GDC air-gapped documentation](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/resources/audiences).

## Before you begin

Before changing the default certificate issuer, you must have the necessary
permissions and prepare your environment.

### Request IAM roles

To create, update, and delete certificate issuers, contact your IAM Org
Admin to request the **PKI Infra Admin** (`infra-pki-admin`) role in the system
namespace.

### Prepare your environment

- [Download](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/resources/gdcloud-download) and
  [install](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/resources/gdcloud-install) the gdcloud CLI,
  if you haven't already done so.

- [Install the kubectl CLI](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/get-started/kubectl).

- [Generate a kubeconfig file](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/resources/gdcloud-auth#get-kubeconfig)
  to configure `kubectl` access.

## Change default certificate issuer

1. The default issuer label looks like the following example. For each namespace,
   one `CertificateIssuer` must contain the label:

       pki.security.gdc.goog/is-default-issuer: 'true'

2. View the current default issuer in the `pki-system` namespace:

       kubectl get certificateissuers -n pki-system -l pki.security.gdc.goog/is-default-issuer=true

   The output looks similar to the following:

       NAME                    READY   REASON       ISDEFAULT
       default-tls-ca-issuer   True    CAaaSReady   true

3. Edit the existing default issuer, and update the default issuer label
   from the issuer:

       kubectl label --overwrite certificateissuers CURRENT_DEFAULT_ISSUER -n pki-system pki.security.gdc.goog/is-default-issuer='false'

   Replace <var translate="no">CURRENT_DEFAULT_ISSUER</var> with the name of the
   current default certificate issuer.
4. To set the new `CertificateIssuer` as the default issuer, update the label:

       kubectl label --overwrite certificateissuers NEW_DEFAULT_ISSUER -n pki-system pki.security.gdc.goog/is-default-issuer=true

   Replace <var translate="no">NEW_DEFAULT_ISSUER</var> with the name of the new
   default certificate issuer.

## Manually trigger certificate reissuance

After you switch the default certificate issuer, Distributed Cloud
won't automatically reissue certificates signed by the previous default
certificate issuer unless the certificate is about to expire. To immediately
reissue certificates with the new default issuer, see
[Manually reissue PKI web certificates](https://docs.cloud.google.com/distributed-cloud/hosted/docs/1.16/gdcag/platform/pa-user/pki/pki-cert-reissue).