Learning CoreDNS

Book Description

Until recently, learning CoreDNS required reading the code or combing through the skimpy documentation on the website. No longer. With this practical book, developers and operators working with Docker or Linux containers will learn how to use this standard DNS server with Kubernetes.

John Belamaric, senior staff software engineer at Google, and Cricket Liu, chief DNS architect at Infoblox, show you how to configure CoreDNS using real-world configuration examples to achieve specific purposes. You’ll learn the basics of DNS, including how it functions as a location broker in container environments and how it ties into Kubernetes.

  • Dive into DNS theory: the DNS namespace, domain names, domains, and zones
  • Learn how to configure your CoreDNS server
  • Manage and serve basic and advanced zone data with CoreDNS
  • Configure CoreDNS service discovery with etcd and Kubernetes
  • Learn one of the most common use cases for CoreDNS: the integration with Kubernetes
  • Manipulate queries and responses as they flow through the plug-in chain
  • Monitor and troubleshoot the availability and performance of your DNS service
  • Build custom versions of CoreDNS and write your own plug-ins

Publisher Resources

View/Submit Errata

Table of Contents

  1. Preface
    1. Why a New DNS Server?
    2. Who Needs CoreDNS?
    3. Who This Book Is For
    4. What You Will Learn
    5. Conventions Used in This Book
    6. Using Code Examples
    7. O’Reilly Online Learning
    8. How to Contact Us
    9. Acknowledgments
  2. 1. Introduction
    1. What Is CoreDNS?
      1. CoreDNS, Containers, and Microservices
      2. CoreDNS Limitations
      3. CoreDNS, Kubernetes, and the Cloud Native Computing Foundation
  3. 2. A DNS Refresher
    1. What Is the Domain Name System?
    2. Domain Names and the Namespace
    3. Domains, Delegation, and Zones
    4. Resource Records
    5. DNS Servers and Authority
    6. Resolvers
    7. Resolution and Recursion
    8. Caching
    9. Resource Records
      1. NAME
      2. TTL
      3. CLASS
    10. Resource Record Types
      1. The A Record
      2. The AAAA Record
      3. The CNAME Record
      4. The MX Record
      5. The NS Record
      6. The SRV Record
      7. The PTR Record
      8. The SOA Record
    11. An Annotated Zone Data File
  4. 3. Configuring CoreDNS
    1. Getting CoreDNS
    2. CoreDNS Command-Line Options
    3. Corefile Syntax
      1. Environment Variables
      2. Reusable Snippets
      3. Import
      4. Server Blocks
      5. Query Processing
    4. Plug-ins
      1. Root
      2. File
      3. Secondary
      4. Forward
      5. Cache
      6. Errors
      7. Log
    5. Common Configuration Options
      1. fallthrough
      2. tls
      3. transfer to
    6. Sample DNS Server Configurations
      1. Caching-Only DNS Server
      2. Primary DNS Server
      3. Secondary DNS Server
  5. 4. Managing Zone Data
    1. The file Plug-in
    2. The auto Plug-in
      1. Using the auto Plug-in with Git
    3. The hosts Plug-in
    4. The route53 plug-in
  6. 5. Service Discovery
    1. Introduction to Service Discovery
    2. Solving the Service Discovery Problem
    3. Service Discovery with CoreDNS and etcd
      1. The etcd Plug-in
      2. Other Service Discovery Options
    4. Service Discovery and Container Orchestration
  7. 6. Kubernetes
    1. Basic Concepts
    2. Kubernetes Networking
      1. Cluster IP Services
      2. Headless Services
    3. Kubernetes DNS Specification
    4. CoreDNS Integration
    5. Default Configuration
    6. Stub Domains and Federations
    7. Cluster DNS Deployment Resources
      1. Role-Based Access Control
      2. Service
      3. Deployment
    8. Autoscaling
    9. A Better Configuration
    10. The kubernetes Plug-in
    11. CoreDNS Extensions
      1. Pod Options
      2. Wildcard Queries
      3. Autopath and the Dreaded ndots:5
      4. Zone Transfer Support
      5. Exposing Services Externally
      6. Modifying the Available Records
  8. 7. Manipulating Queries and Responses
    1. The template Plug-in
    2. The rewrite Plug-in
      1. Using the rewrite Plug-in for EDNS0 Options
      2. Multiple rewrite Rules
    3. The metadata Plug-in
    4. Signing Responses with the DNS Security Extensions
      1. Managing a DNSSEC-Signed Primary Zone
      2. On-the-Fly DNSSEC Signing with the dnssec Plug-in
    5. Case Study: Infoblox’s BloxOne Threat Defense
      1. Identifying Users
      2. Applying Policy
  9. 8. Monitoring and Troubleshooting
    1. The prometheus Plug-in
    2. The log Plug-in
    3. The dnstap Plug-in
    4. The errors Plug-in
    5. The trace Plug-in
    6. The debug Plug-in
  10. 9. Building a Custom Server
    1. Compiling CoreDNS with an External Plug-in
      1. Building Using Docker
      2. Building on Your Workstation
      3. Modifying plugin.cfg
      4. Replacing main
    2. Writing a Custom Plug-in
      1. There Can Be Only One
      2. Integrating with Metrics, Trace, and Metadata
  11. Index

Product Information

  • Title: Learning CoreDNS
  • Author(s): John Belamaric, Cricket Liu
  • Release date: September 2019
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492047964