coredns-crd
by anngdinh
Additional CoreDNS deployment with k8s_crd plugin for handling DNSEndpoints
About this chart
CoreDNS
CoreDNS is a DNS server that chains plugins and provides DNS Services
TL;DR;
$ helm repo add coredns https://coredns.github.io/helm
$ helm --namespace=kube-system install coredns coredns/coredns
Introduction
This chart bootstraps a CoreDNS deployment on a Kubernetes cluster using the Helm package manager. This chart will provide DNS Services and can be deployed in multiple configuration to support various scenarios listed below:
- CoreDNS as a cluster dns service and a drop-in replacement for Kube/SkyDNS. This is the default mode and CoreDNS is deployed as cluster-service in kube-system namespace. This mode is chosen by setting
isClusterServiceto true. - CoreDNS as an external dns service. In this mode CoreDNS is deployed as any kubernetes app in user specified namespace. The CoreDNS service can be exposed outside the cluster by using using either the NodePort or LoadBalancer type of service. This mode is chosen by setting
isClusterServiceto false. - CoreDNS as an external dns provider for kubernetes federation. This is a sub case of 'external dns service' which uses etcd plugin for CoreDNS backend. This deployment mode as a dependency on
etcd-operatorchart, which needs to be pre-installed.
Prerequisites
- Kubernetes 1.10 or later
Installing the Chart
The chart can be installed as follows:
$ helm repo add coredns https://coredns.github.io/helm
$ helm --namespace=kube-system install coredns coredns/coredns
The command deploys CoreDNS on the Kubernetes cluster in the default configuration. The configuration section lists various ways to override default configuration during deployment.
Tip: List all releases using
helm list --all-namespaces
OCI installing
The chart can also be installed using the following:
$ helm --namespace=kube-system install coredns oci://ghcr.io/coredns/charts/coredns --version 1.38.0
The command deploys the 1.38.0 version of CoreDNS on the Kubernetes cluster in the default configuration.
Helm Unit Testing & Debugging Guide
This document explains how to write, run, and debug Helm unit tests for this chart using helm-unittest.
Prerequisites
Install the Helm unittest plugin:
helm plugin install https://github.com/helm-unittest/helm-unittest
Running Unit Tests
Run all unit tests in the chart folder (e.g., ./coredns):
helm unittest ./coredns
To output results in JUnit XML format:
mkdir -p test-results
helm unittest --strict \
--output-type JUnit \
--output-file test-results/helm-unittest-report.xml \
./coredns
Debugging Helm Charts
Render the chart templates with real values to debug:
helm template ./coredns --debug
YAML Intellisense in VS Code
Add this line at the top of your unit test YAML files for schema validation and autocompletion in VS Code:
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
This improves YAML editing and error highlighting for test definitions.
Uninstalling the Chart
To uninstall/delete the coredns deployment:
$ helm uninstall coredns
The command removes all the Kubernetes components associated with the chart and deletes the release.
Configuration
| Parameter | Description | Default |
|---|---|---|
image.repository | The image repository to pull from | coredns/coredns |
image.tag | The image tag to pull from (derived from Chart.yaml) | `` |
image.pullPolicy | Image pull policy | IfNotPresent |
image.pullSecrets | Specify container image pull secrets | [] |
replicaCount | Number of replicas | 1 |
resources.limits.cpu | Container maximum CPU | 100m |
resources.limits.memory | Container maximum memory | 128Mi |
resources.requests.cpu | Container requested CPU | 100m |
resources.requests.memory | Container requested memory | 128Mi |
serviceType | Kubernetes Service type | ClusterIP |
prometheus.service.enabled | Set this to true to create Service for Prometheus metrics | false |
prometheus.service.annotations | Annotations to add to the metrics Service | {prometheus.io/scrape: "true", prometheus.io/port: "9153"} |
prometheus.service.selector | Pod selector | {} |
prometheus.monitor.enabled | Set this to true to create ServiceMonitor for Prometheus operator | false |
prometheus.monitor.additionalLabels | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | {} |
prometheus.monitor.namespace | Selector to select which namespaces the Endpoints objects are discovered from. | "" |
prometheus.monitor.interval | Scrape interval for polling the metrics endpoint. (E.g. "30s") | "" |
prometheus.monitor.selector | Service selector | {} |
service.clusterIP | IP address to assign to service | "" |
service.clusterIPs | IP addresses to assign to service | [] |
service.loadBalancerIP | IP address to assign to load balancer (if supported) | "" |
service.externalIPs | External IP addresses | [] |
service.externalTrafficPolicy | Enable client source IP preservation | [] |
service.ipFamilyPolicy | Service dual-stack policy | "" |
service.annotations | Annotations to add to service | {} |
service.selector | Pod selector | {} |
service.trafficDistribution | Service traffic routing strategy | |
serviceAccount.create | If true, create & use serviceAccount | false |
serviceAccount.name | If not set & create is true, use template fullname | |
rbac.create | If true, create & use RBAC resources | true |
rbac.pspEnable | Specifies whether a PodSecurityPolicy should be created. | false |
rbac.multiclusterEnable | Specifies whether the kubernetes plugin multicluster RBAC should be created. | false |
isClusterService | Specifies whether chart should be deployed as cluster-service or normal k8s app. | true |
priorityClassName | Name of Priority Class to assign pods | "" |
securityContext | securityContext definition for pods | capabilities.add.NET_BIND_SERVICE |
servers | Configuration for CoreDNS and plugins | See values.yml |
livenessProbe.enabled | Enable/disable the Liveness probe | true |
livenessProbe.initialDelaySeconds | Delay before liveness probe is initiated | 60 |
livenessProbe.periodSeconds | How often to perform the probe | 10 |
livenessProbe.timeoutSeconds |
Deploy coredns-crd with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has coredns-crd on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcoredns-crd is pinned at v1.45.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply