> [!WARNING]
>
> **Preview**
>
>
> This product or feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section
> of the [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA products and features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

This document shows how to configure certificate lifecycle management for managed workloads such as Compute Engine and Google Kubernetes Engine (GKE), using Certificate Manager (2nd gen). You can automate certificate issuance and renewal by linking a managed workload identity pool to a Certificate Authority Service pool using a certificate issuance configuration. This helps prevent service outages caused by expired certificates.

## How managed workload identity works

[Managed workload identity](https://docs.cloud.google.com/iam/docs/managed-workload-identity) gives your
Compute Engine and GKE workloads an attested identity, along
with a certificate and the trust anchors that the workloads use to
authenticate to each other over mutual TLS (mTLS). Managed workload identities
are grouped into a workload identity pool, which acts as the trust boundary
for the identities in it.

When you link a workload identity pool to a CA Service pool,
Google Cloud automatically issues and renews certificates for your workloads.
This automation eliminates manual credential management and prevents service
outages.

## Before you begin

<br />

1. Make sure that you have an existing workload identity pool with managed workload identities. For more information, see [Configure managed
   workload identity authentication for Compute Engine](https://docs.cloud.google.com/iam/docs/create-managed-workload-identities) or [Configure managed
   workload identity authentication for GKE](https://docs.cloud.google.com/iam/docs/create-managed-workload-identities-gke).
2. Make sure that you have an existing CA Service pool that can issue certificates to your workloads. For more information, see [Create a CA
   pool](https://docs.cloud.google.com/certificate-authority-service/docs/creating-ca-pool).

### Required roles


To get the permissions that
you need to configure lifecycle management,

ask your administrator to grant you the
following IAM roles on your project:

- [Certificate Manager Editor](https://docs.cloud.google.com/iam/docs/roles-permissions/certificatemanager#certificatemanager.editor) (`roles/certificatemanager.editor`)
- [CA Service Certificate Manager](https://docs.cloud.google.com/iam/docs/roles-permissions/privateca#privateca.certificateManager) (`roles/privateca.certificateManager`)
- [Workload Identity Pool Admin](https://docs.cloud.google.com/iam/docs/roles-permissions/iam#iam.workloadIdentityPoolAdmin) (`roles/iam.workloadIdentityPoolAdmin`)


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access).


You might also be able to get
the required permissions through [custom
roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or other [predefined
roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

## Configure lifecycle for managed workloads

Configure a managed workload identity pool to specify how associated workloads
receive and renew certificates from your existing CA Service
pool.

1. In the Google Cloud console, go to the **Certificate Manager (2nd gen)** page.

   [Go to Certificate Manager (2nd gen)](https://console.cloud.google.com/security/ccm/landing)
2. In the navigation pane, click **Manage Lifecycle**.
3. Select the **Managed Workload Identity** tab.
4. Locate the workload identity pool that you want to configure, and then click **Configure lifecycle management**.
5. Select the **Region** and the **CA pool** for the region.
6. In the **Certificate lifetime** field, specify the validity of the issued certificate. The value must be between 21 and 30 days.
7. Set the **Rotation window** to a value between 50 and 80. This is the percentage of the certificate's lifetime that triggers a renewal.
8. In the **Key algorithm** field, select the encryption algorithm to use to generate the private key.
9. Click **Update**.

## What's next

- [View certificate inventory](https://docs.cloud.google.com/certificate-manager/docs/v2/inventory)
- [Create issuance configuration](https://docs.cloud.google.com/certificate-manager/docs/v2/issuance-configuration)
- [Monitor your certificates](https://docs.cloud.google.com/certificate-manager/docs/v2/monitor)
- [Configure lifecycle management for load balancers](https://docs.cloud.google.com/certificate-manager/docs/v2/configure-load-balancers)
- [Create trust configuration](https://docs.cloud.google.com/certificate-manager/docs/v2/trust-configuration)