List DNS records

This document guides you on how to list DNS records in a DNS zone in Google Distributed Cloud (GDC) air-gapped.

Before you begin

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

  • The necessary identity and access roles. To list DNS records for your project, ask your Project IAM Admin to grant you the Managed DNS Project Viewer (managed-dns-project-viewer) 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.

List DNS records

You can list DNS records using the gdcloud CLI or the Kubernetes API.

gdcloud

To list all DNS records in a project, use the gdcloud dns record-sets list command:

gdcloud dns record-sets list \
    --dns-zone=DNS_ZONE_NAME \
    [--project=PROJECT_NAMESPACE]

To fetch a single DNS record by name, use the gdcloud dns record-sets describe command:

gdcloud dns record-sets describe RESOURCE_RECORD_NAME \
    [--dns-zone=DNS_ZONE_NAME] \
    [--project=PROJECT_NAMESPACE]

Replace the following:

  • RESOURCE_RECORD_NAME: the name of the DNS record to fetch.
  • DNS_ZONE_NAME: the name of the DNS zone containing the records (optional).
  • PROJECT_NAMESPACE: the namespace of your project. This flag is optional if you have set a default project globally using gdcloud config set project.

API

Use the Kubernetes API in GDC to list DNS records.

To list a single record, run the following command:

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

To list all DNS Records under a project, run the following command:

kubectl --kubeconfig GLOBAL_API_SERVER get resourcerecordset.networking.global.gdc.goog -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 listed such as cname.system.example.com.
  • PROJECT_NAMESPACE: the namespace of your project.