Delete DNS records

This document guides you through how to delete a DNS record when it is no longer needed. The intended audience for this document is platform administrators and application operators responsible for managing DNS records within a project.

Before you begin

To delete DNS records in GDC, you must have the following:

  • An existing DNS record in a DNS zone. See List DNS records for guidance on listing your current records.
  • The necessary identity and access roles. To manage DNS records for your project, ask your Project IAM 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.
  • If you are using kubectl, a kubeconfig file for the global API server. If you have not yet generated this file, see Sign in. For more information, see Global and zonal API servers.

Delete a DNS record

You can delete a DNS record using the gdcloud CLI or the Kubernetes API.

gdcloud

To delete a DNS record, use the gdcloud dns record-sets delete command:

gdcloud dns record-sets delete RESOURCE_RECORD_NAME \
    [--project=PROJECT_NAMESPACE] \
    [--async]

Replace the following:

  • RESOURCE_RECORD_NAME: The name of the DNS record to delete.
  • 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 to check on the status of the operation.

API

Use the Kubernetes API in GDC to delete a DNS record:

kubectl --kubeconfig GLOBAL_API_SERVER \
delete resourcerecordset.networking.global.gdc.goog RESOURCE_RECORD_NAME \
-n PROJECT_NAMESPACE

Replace the following:

  • GLOBAL_API_SERVER: the global API server's kubeconfig path. For more information, see Global and zonal API servers. If you have not yet generated a kubeconfig file for the API server, see Sign in for details.
  • RESOURCE_RECORD_NAME: the DNS record to be deleted, such as myhost.system.example.com.
  • PROJECT_NAMESPACE: the namespace of your project.