This document guides you on how to update previously created public and private
DNS zones in Google Distributed Cloud (GDC) air-gapped.

## Before you begin

To update DNS zones in GDC, you must have the following:

- An existing public or private DNS zone. See [List DNS zones](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/dns/list-dns-zones.md.txt) for guidance on listing your current zones.
- The necessary identity and access roles. To manage DNS zones for your project, ask your **IAM Project Admin** to grant you the **Managed DNS Project Admin** (`managed-dns-project-admin`) role.
- To use the gdcloud CLI, ensure you have it installed. For more information, see [Install the gdcloud CLI](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-install.md.txt).
- If you are using `kubectl`, a kubeconfig file for the global API server. If you have not yet generated this file, see [Sign in](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/iam/sign-in.md.txt#global-resources-kubeconfig). For more information, see [Global and zonal API servers](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/multi-zone/api-servers.md.txt).

## Update a public or private DNS zone

> [!NOTE]
> **Note:** You can only update the DNS name description field (`description`). You can't update the DNS zone name (`dnsName`), or the zone type (`visibility`) identifying the zone as public or private.

You can update a public or private DNS zone using the gdcloud CLI or
the Kubernetes API.

### gdcloud

To update the description of a DNS zone, use the
[`gdcloud dns managed-zones update`](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-reference/gdcloud-dns-managed-zones-update.md.txt)
command:

```bash
gdcloud dns managed-zones update DNS_ZONE_NAME \
    --description="NEW_DESCRIPTION" \
    [--project=PROJECT_NAMESPACE] \
    [--async]
```

Replace the following:

- `DNS_ZONE_NAME`: the name of your DNS zone to update.
- `NEW_DESCRIPTION`: the updated description for your DNS zone. For example, `Public DNS zone for mydomain.com`.
- `PROJECT_NAMESPACE`: the namespace of your project. This flag is optional if you have set a default project globally using `gdcloud config set project`.
- `--async`: Specify this if you want the command to return immediately, rather than wait for the operation to complete. You can use [`describe`](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/dns/list-dns-zones.md.txt#list-dns-zones) to check on the status of the operation.

### kubectl

Use the Kubernetes API in GDC to update a public or private DNS zone:

```yaml
kubectl --kubeconfig GLOBAL_API_SERVER apply -f - <<EOF
apiVersion: networking.global.gdc.goog/v1
kind: ManagedDNSZone
metadata:
  name: DNS_ZONE_NAME
  namespace: PROJECT_NAMESPACE
spec:
  dnsName: DOMAIN_NAME
  description: NEW_DESCRIPTION
  visibility: PUBLIC
EOF
```

Replace the following:

- `GLOBAL_API_SERVER`: the global API server's kubeconfig path. For more information, see [Global and zonal API servers](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/multi-zone/api-servers.md.txt). If you have not yet generated a kubeconfig file for the API server, see [Sign in](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/iam/sign-in.md.txt#cli) for details.
- `DNS_ZONE_NAME`: the name of your DNS zone which needs to be updated.
- `PROJECT_NAMESPACE`: the namespace of your project.
- `DOMAIN_NAME`: the domain name for your public DNS zone, such as `example.com`.
- `NEW_DESCRIPTION`: the updated description for your DNS zone. For example, `Public DNS zone for mydomain.com`.