Google Distributed Cloud (GDC) air-gapped appliance provides a [public key infrastructure (PKI) API](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/appliance/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/latest/appliance/platform/pa-user/pki/web-tls-cert-config).

## 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 Organization IAM
Admin to request the **Infra PKI Admin** (`infra-pki-admin`) role in the system
namespace.

### Prepare your environment

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

- Install the `kubectl` CLI, as described in
  [Install components](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/appliance/resources/gdcloud-install#install-components).

- [Generate a kubeconfig file](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/appliance/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, GDC air-gapped appliance
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/latest/appliance/platform/pa-user/pki/pki-cert-reissue).