Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Running NSD on Kubernetes

License

NotificationsYou must be signed in to change notification settings

The-Kube-Way/nsd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DockerProject Status: Active – The project has reached a stable, usable state and is being actively developed.

What is this software

NSD is an authoritative only, high performance, simple and open source name server released under the BSD licence.This work is originally based onhardware/nsd-dnssec.

Features

  • Lightweight & secure image (based on Alpine & multi-stage build: 4MB, no root process)
  • Latest NSD version with hardening compilation options
  • Helper scripts for generating ZSK and KSK keys, DS-Records management and zone signature
  • Optimized to be run on Kubernetes with ConfigMap

Run on Kubernetes

Seedocs/KUBERNETES.md

Run with Docker-compose

version:'3.7'services:nsd:container_name:nsdrestart:alwaysimage:ghcr.io/the-kube-way/nsd:latest# or nsd:vX.X.Xread_only:truetmpfs:      -/tmp      -/var/db/nsdvolumes:      -/mnt/nsd/conf:/etc/nsd:ro      -/mnt/nsd/zones:/zones      -/mnt/nsd/keys:/keys:roports:      -53:53      -53:53/udp

Ensure mount points match UID/GID (991 by default) used by nsd.

/etc/nsd should be mounted read-only.
/zones can be mounted read-only if helper scripts (e.g. for dnssec) are not used.
/keys should be mounted read-only if keygen helper script is not used.

Configuration example

Put your dns zone file in/mnt/nsd/zones/domain.tld.

$ORIGIN domain.tld.$TTL 3600; SOA; SOA record should be on one line to use provided helper scripts@   IN   SOA   ns1.domain.tld. hostmaster.domain.tld. 2016020202 7200 1800 1209600 86400; NAMESERVERS@                   IN                NS                   ns1.domain.tld.@                   IN                NS                   ns2.domain.tld.; A RECORDS@                   IN                A                    1.2.3.4www                 IN                A                    5.6.7.8...

Put the nsd config in/mnt/nsd/conf/nsd.conf.

server:server-count:1verbosity:1hide-version:yeszonesdir:"/zones"zone:name:domain.tld#zonefile: domain.tld  # if not signedzonefile:domain.tld.signed

Check thedocumentation to see all options.

Check the configuration

Check your zone and nsd configuration:

cd /mnt/nsddocker run -it --rm -v$(pwd)/zones:/zones selfhostingtools/nsd nsd-checkzone domain.tld /zones/domain.tlddocker run -it --rm -v$(pwd)/conf:/etc/nsd selfhostingtools/nsd nsd-checkconf /etc/nsd/nsd.conf

Environment variables

You may want to change the running user:

VariableDescriptionTypeDefault value
UIDnsd user idoptional991
GIDnsd group idoptional991

Generating DNSSEC keys and signed zone

Generate ZSK and KSK keys with ECDSAP384SHA384 algorithm:

docker-composeexec nsd keygen domain.tld

Keys will be stored in/keys/Kdomain.tld.{zsk,ksk}.{key,private}

Then sign your dns zone (default expiration date is 1 month):

docker-composeexec nsd signzone domain.tld# or set custom RRSIG RR expiration date:docker-composeexec nsd signzone domain.tld [YYYYMMDDhhmmss]

⚠️Do not forget to add a cron task to sign your zone periodically to avoid the expiration of RRSIG RR records!

This can be done using systemd timer on the host:

/etc/systemd/system/nsd_update_signature.service

[Unit]Description=NSD update signature[Service]Type=oneshotExecStart=docker exec nsd signzone domain.tld

/etc/systemd/system/nsd_update_signature.timer

[Timer]OnCalendar=weekly[Install]WantedBy=multi-user.target

Don't forget to enable and start the timer!

Show your DS-Records (Delegation Signer):

docker-composeexec nsd ds-records domain.tld

Ensure zonefile parameter is correctly set (e.g. domain.tld.signed) innsd.conf.

Restart nsd to take the changes into account:

docker-compose restart nsd

Build the image

Build-time variables:

  • NSD_VERSION : version of NSD
  • SHA256_HASH : SHA256 hash of NSD archive

[8]ページ先頭

©2009-2025 Movatter.jp