diff --git a/charts/node-local-dns/.helmignore b/charts/node-local-dns/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/node-local-dns/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/node-local-dns/Chart.yaml b/charts/node-local-dns/Chart.yaml new file mode 100644 index 0000000..250e4bb --- /dev/null +++ b/charts/node-local-dns/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +appVersion: 1.22.23 +description: 'A chart to install node-local-dns. NodeLocal DNSCache improves Cluster + DNS performance by running a DNS caching agent on cluster nodes as a DaemonSet. In + today''s architecture, Pods in ''ClusterFirst'' DNS mode reach out to a kube-dns + serviceIP for DNS queries. This is translated to a kube-dns/CoreDNS endpoint via + iptables rules added by kube-proxy. With this new architecture, Pods will reach + out to the DNS caching agent running on the same node, thereby avoiding iptables + DNAT rules and connection tracking. The local caching agent will query kube-dns + service for cache misses of cluster hostnames ("cluster.local" suffix by default). Further + documentation is [here](https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/) This + helm chart works for both kube-proxy setups (iptables or ipvs). ' +icon: https://miro.medium.com/max/641/1*q3vcbyVXcvaRnFLEQEHrXw.png +maintainers: +- email: no-reply@deliveryhero.com + name: gabrieladt +name: node-local-dns +version: 2.0.4 diff --git a/charts/node-local-dns/README.md b/charts/node-local-dns/README.md new file mode 100644 index 0000000..9af0799 --- /dev/null +++ b/charts/node-local-dns/README.md @@ -0,0 +1,89 @@ +# node-local-dns + +![Version: 2.0.4](https://img.shields.io/badge/Version-2.0.4-informational?style=flat-square) ![AppVersion: 1.22.23](https://img.shields.io/badge/AppVersion-1.22.23-informational?style=flat-square) + +A chart to install node-local-dns. + +NodeLocal DNSCache improves Cluster DNS performance by running a DNS caching agent on cluster nodes as a DaemonSet. + +In today's architecture, Pods in 'ClusterFirst' DNS mode reach out to a kube-dns serviceIP for DNS queries. This is translated to a kube-dns/CoreDNS endpoint via iptables rules added by kube-proxy. With this new architecture, Pods will reach out to the DNS caching agent running on the same node, thereby avoiding iptables DNAT rules and connection tracking. The local caching agent will query kube-dns service for cache misses of cluster hostnames ("cluster.local" suffix by default). + +Further documentation is [here](https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/) + +This helm chart works for both kube-proxy setups (iptables or ipvs). + +## How to install this chart + +Add Delivery Hero public chart repo: + +```console +helm repo add deliveryhero https://charts.deliveryhero.io/ +``` + +A simple install with default values: + +```console +helm install deliveryhero/node-local-dns +``` + +To install the chart with the release name `my-release`: + +```console +helm install my-release deliveryhero/node-local-dns +``` + +To install with some set values: + +```console +helm install my-release deliveryhero/node-local-dns --set values_key1=value1 --set values_key2=value2 +``` + +To install with custom values file: + +```console +helm install my-release deliveryhero/node-local-dns -f values.yaml +``` + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| config.commProtocol | string | `"force_tcp"` | | +| config.customConfig | string | `""` | | +| config.dnsDomain | string | `"cluster.local"` | | +| config.dnsServer | string | `"172.20.0.10"` | | +| config.healthPort | int | `8080` | | +| config.localDns | string | `"169.254.20.25"` | | +| config.setupInterface | bool | `true` | | +| config.setupIptables | bool | `true` | | +| config.skipTeardown | bool | `false` | | +| daemonsetAnnotations | object | `{}` | | +| daemonsetLabels | object | `{}` | | +| dashboard.annotations | object | `{}` | | +| dashboard.enabled | bool | `false` | | +| dashboard.label | string | `"grafana_dashboard"` | | +| dashboard.namespace | string | `"kube-system"` | | +| fullnameOverride | string | `""` | | +| image.repository | string | `"registry.k8s.io/dns/k8s-dns-node-cache"` | | +| image.tag | string | `""` | | +| imagePullSecrets | list | `[]` | | +| nameOverride | string | `""` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| prometheusScraping.enabled | bool | `true` | | +| resources.limits.memory | string | `"128Mi"` | | +| resources.requests.cpu | string | `"25m"` | | +| resources.requests.memory | string | `"128Mi"` | | +| securityContext.capabilities.add[0] | string | `"NET_ADMIN"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| serviceMonitor.enabled | bool | `false` | | +| serviceMonitor.labels | object | `{}` | | + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| gabrieladt | | | diff --git a/charts/node-local-dns/dashboard.json b/charts/node-local-dns/dashboard.json new file mode 100644 index 0000000..cb9dce3 --- /dev/null +++ b/charts/node-local-dns/dashboard.json @@ -0,0 +1,1637 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "4.4.3" + }, + { + "type": "panel", + "id": "graph", + "name": "Graph", + "version": "" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "description": "A dashboard for the CoreDNS DNS server with updated metrics for version 1.7.0+. Based on the CoreDNS dashboard by buhay.", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 12539, + "graphTooltip": 0, + "id": 28, + "iteration": 1680883021604, + "links": [ + { + "icon": "external link", + "tags": [], + "targetBlank": true, + "title": "NodeLocalDNS", + "type": "link", + "url": "https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns/nodelocaldns" + }, + { + "icon": "external link", + "tags": [], + "targetBlank": true, + "title": "CoreDNS.io", + "type": "link", + "url": "https://coredns.io" + } + ], + "liveNow": false, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "total", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_dns_request_count_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (proto) or\nsum(rate(coredns_dns_requests_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (proto)", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}", + "refId": "A", + "step": 60 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests (total)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 0 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "total", + "yaxis": 2 + }, + { + "alias": "other", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "exemplar": true, + "expr": "sum(rate(coredns_dns_request_type_count_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (type) or \nsum(rate(coredns_dns_requests_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (type)", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{type}}", + "refId": "A", + "step": 60 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests (by qtype)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 0 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "total", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_dns_request_count_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (zone) or\nsum(rate(coredns_dns_requests_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (zone)", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{zone}}", + "refId": "A", + "step": 60 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests (by zone)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 7 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "total", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_dns_request_do_count_total{instance=~\"$instance\", job=~\"$job\"}[5m])) or\nsum(rate(coredns_dns_do_requests_total{instance=~\"$instance\", job=~\"$job\"}[5m]))", + "interval": "", + "intervalFactor": 2, + "legendFormat": "DO", + "refId": "A", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_dns_request_count_total{instance=~\"$instance\", job=~\"$job\"}[5m])) or\nsum(rate(coredns_dns_requests_total{instance=~\"$instance\", job=~\"$job\"}[5m]))", + "interval": "", + "intervalFactor": 2, + "legendFormat": "total", + "refId": "B", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests (DO bit)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "pps", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 7 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "tcp:90", + "yaxis": 2 + }, + { + "alias": "tcp:99 ", + "yaxis": 2 + }, + { + "alias": "tcp:50", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.99, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"udp\"}[5m])) by (le,proto))", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:99 ", + "refId": "A", + "step": 60 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.90, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"udp\"}[5m])) by (le,proto))", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:90", + "refId": "B", + "step": 60 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.50, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"udp\"}[5m])) by (le,proto))", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:50", + "refId": "C", + "step": 60 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests (size, udp)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 7 + }, + "hiddenSeries": false, + "id": 12, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "tcp:90", + "yaxis": 1 + }, + { + "alias": "tcp:99 ", + "yaxis": 1 + }, + { + "alias": "tcp:50", + "yaxis": 1 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.99, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"tcp\"}[5m])) by (le,proto))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:99 ", + "refId": "A", + "step": 60 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.90, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"tcp\"}[5m])) by (le,proto))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:90", + "refId": "B", + "step": 60 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.50, sum(rate(coredns_dns_request_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"tcp\"}[5m])) by (le,proto))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:50", + "refId": "C", + "step": 60 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests (size,tcp)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 14 + }, + "hiddenSeries": false, + "id": 14, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_dns_response_rcode_count_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (rcode) or\nsum(rate(coredns_dns_responses_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (rcode)", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{rcode}}", + "refId": "A", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Responses (by rcode)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 14 + }, + "hiddenSeries": false, + "id": 32, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.99, sum(rate(coredns_dns_request_duration_seconds_bucket{instance=~\"$instance\", job=~\"$job\"}[5m])) by (le, job))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "99%", + "refId": "A", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.90, sum(rate(coredns_dns_request_duration_seconds_bucket{instance=~\"$instance\", job=~\"$job\"}[5m])) by (le))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "90%", + "refId": "B", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.50, sum(rate(coredns_dns_request_duration_seconds_bucket{instance=~\"$instance\", job=~\"$job\"}[5m])) by (le))", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "50%", + "refId": "C", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Responses (duration)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 21 + }, + "hiddenSeries": false, + "id": 18, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "udp:50%", + "yaxis": 1 + }, + { + "alias": "tcp:50%", + "yaxis": 2 + }, + { + "alias": "tcp:90%", + "yaxis": 2 + }, + { + "alias": "tcp:99%", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.99, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"udp\"}[5m])) by (le,proto)) ", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:99%", + "refId": "A", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.90, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"udp\"}[5m])) by (le,proto)) ", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:90%", + "refId": "B", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.50, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"udp\"}[5m])) by (le,proto)) ", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:50%", + "metric": "", + "refId": "C", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Responses (size, udp)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 21 + }, + "hiddenSeries": false, + "id": 20, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "udp:50%", + "yaxis": 1 + }, + { + "alias": "tcp:50%", + "yaxis": 1 + }, + { + "alias": "tcp:90%", + "yaxis": 1 + }, + { + "alias": "tcp:99%", + "yaxis": 1 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.99, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"tcp\"}[5m])) by (le,proto)) ", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:99%", + "refId": "A", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.90, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"tcp\"}[5m])) by (le,proto)) ", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:90%", + "refId": "B", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "histogram_quantile(0.50, sum(rate(coredns_dns_response_size_bytes_bucket{instance=~\"$instance\", job=~\"$job\",proto=\"tcp\"}[5m])) by (le, proto)) ", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{proto}}:50%", + "metric": "", + "refId": "C", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Responses (size, tcp)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 28 + }, + "hiddenSeries": false, + "id": 22, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(coredns_cache_size{instance=~\"$instance\", job=~\"$job\"}) by (type) or\nsum(coredns_cache_entries{instance=~\"$instance\", job=~\"$job\"}) by (type)", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{type}}", + "refId": "A", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Cache (size)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "decbytes", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 28 + }, + "hiddenSeries": false, + "id": 24, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "misses", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_cache_hits_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (type)", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "hits:{{type}}", + "refId": "A", + "step": 40 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum(rate(coredns_cache_misses_total{instance=~\"$instance\", job=~\"$job\"}[5m])) by (type)", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "misses", + "refId": "B", + "step": 40 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Cache (hitrate)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "pps", + "logBase": 1, + "min": 0, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "refresh": "10s", + "schemaVersion": 33, + "style": "dark", + "tags": [ + "dns", + "coredns" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "default", + "value": "default" + }, + "hide": 0, + "includeAll": false, + "multi": false, + "name": "datasource", + "options": [], + "query": "prometheus", + "queryValue": "", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "definition": "label_values(up{job=~\"coredns|node-local-dns\"}, job)", + "hide": 0, + "includeAll": true, + "label": "Job", + "multi": false, + "name": "job", + "options": [], + "query": { + "query": "label_values(up{job=~\"coredns|node-local-dns\"}, job)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "uid": "$datasource" + }, + "definition": "label_values(up{job=~\"$job\"}, instance)", + "hide": 0, + "includeAll": true, + "label": "Instance", + "multi": false, + "name": "instance", + "options": [], + "query": { + "query": "label_values(up{job=~\"$job\"}, instance)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 3, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "utc", + "title": "CoreDNS and NodeLocalDNS", + "uid": "wk9Hj3eEr", + "version": 3, + "weekStart": "" +} diff --git a/charts/node-local-dns/templates/_helpers.tpl b/charts/node-local-dns/templates/_helpers.tpl new file mode 100644 index 0000000..88643ee --- /dev/null +++ b/charts/node-local-dns/templates/_helpers.tpl @@ -0,0 +1,65 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "node-local-dns.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "node-local-dns.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "node-local-dns.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "node-local-dns.labels" -}} +helm.sh/chart: {{ include "node-local-dns.chart" . }} +{{ include "node-local-dns.selectorLabels" . }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/component: "node-local-dns" +app.kubernetes.io/created-by: "node-local-dns" +app.kubernetes.io/part-of: "node-local-dns" +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "node-local-dns.selectorLabels" -}} +app.kubernetes.io/name: {{ include "node-local-dns.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +k8s-app: {{ include "node-local-dns.fullname" . }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "node-local-dns.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "node-local-dns.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/node-local-dns/templates/configmap-dashboard.yaml b/charts/node-local-dns/templates/configmap-dashboard.yaml new file mode 100644 index 0000000..145086f --- /dev/null +++ b/charts/node-local-dns/templates/configmap-dashboard.yaml @@ -0,0 +1,23 @@ +{{- if .Values.dashboard.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "node-local-dns.fullname" . }}-dashboard + {{- if $.Values.dashboard.namespace }} + namespace: {{ $.Values.dashboard.namespace }} + {{- end }} + labels: + {{- include "node-local-dns.labels" . | nindent 4 }} + {{- if $.Values.dashboard.label }} + {{ $.Values.dashboard.label }}: "1" + {{- else }} + grafana_dashboard: "1" + {{- end }} + annotations: + {{- with $.Values.dashboard.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +data: + {{ include "node-local-dns.fullname" . }}-dashboard.json: |- + {{- .Files.Get "dashboard.json" | nindent 4 }} +{{- end -}} diff --git a/charts/node-local-dns/templates/configmap.yaml b/charts/node-local-dns/templates/configmap.yaml new file mode 100644 index 0000000..00f8cde --- /dev/null +++ b/charts/node-local-dns/templates/configmap.yaml @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "node-local-dns.fullname" . }} + namespace: kube-system + labels: + addonmanager.kubernetes.io/mode: Reconcile + {{- include "node-local-dns.labels" . | nindent 4 }} +data: + Corefile: | + {{- if .Values.config.customConfig -}} + {{- tpl .Values.config.customConfig . | nindent 4}} + {{- else }} + {{ .Values.config.dnsDomain }}:53 { + errors + cache { + success 9984 30 + denial 9984 5 + } + reload + loop + bind 0.0.0.0 + forward . __PILLAR__CLUSTER__DNS__ { + {{ .Values.config.commProtocol }} + } + prometheus :9253 + health :{{ .Values.config.healthPort }} + } + in-addr.arpa:53 { + errors + cache 30 + reload + loop + bind 0.0.0.0 + forward . __PILLAR__CLUSTER__DNS__ { + {{ .Values.config.commProtocol }} + } + prometheus :9253 + } + ip6.arpa:53 { + errors + cache 30 + reload + loop + bind 0.0.0.0 + forward . __PILLAR__CLUSTER__DNS__ { + {{ .Values.config.commProtocol }} + } + prometheus :9253 + } + .:53 { + errors + cache 30 + reload + loop + bind 0.0.0.0 + forward . __PILLAR__UPSTREAM__SERVERS__ + prometheus :9253 + } + {{ end }} diff --git a/charts/node-local-dns/templates/daemonset.yaml b/charts/node-local-dns/templates/daemonset.yaml new file mode 100644 index 0000000..dbba55f --- /dev/null +++ b/charts/node-local-dns/templates/daemonset.yaml @@ -0,0 +1,120 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "node-local-dns.fullname" . }} + namespace: kube-system + {{- with .Values.daemonsetAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "node-local-dns.labels" . | nindent 4 }} + {{- with .Values.daemonsetLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 10% + selector: + matchLabels: + k8s-app: {{ include "node-local-dns.name" . }} + template: + metadata: + labels: + {{- if .Values.podLabels }} + {{- toYaml .Values.podLabels | nindent 8 }} + {{- end }} + k8s-app: {{ include "node-local-dns.name" . }} + {{- if or .Values.podAnnotations (not .Values.serviceMonitor.enabled) }} + annotations: + {{- end }} + {{- if and (not .Values.serviceMonitor.enabled) .Values.prometheusScraping.enabled }} + prometheus.io/port: "9253" + prometheus.io/scrape: "true" + {{- end }} + {{- if .Values.podAnnotations }} + {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} + spec: + {{- if .Values.affinity }} + affinity: {{- toYaml .Values.affinity | nindent 8 }} + {{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }} + {{- end }} + priorityClassName: system-node-critical + serviceAccountName: {{ include "node-local-dns.serviceAccountName" . }} + hostNetwork: {{ .Values.config.setupIptables }} + dnsPolicy: Default # Don't use cluster DNS. + tolerations: + - key: "CriticalAddonsOnly" + operator: "Exists" + - effect: "NoExecute" + operator: "Exists" + - effect: "NoSchedule" + operator: "Exists" + containers: + - name: node-cache + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + {{- with .Values.resources }} + resources: {{- toYaml . | nindent 10 }} + {{- end }} + args: + {{- if .Values.config.setupIptables }} + - "-localip" + - "{{ .Values.config.localDns }},{{ .Values.config.dnsServer }}" + {{- else }} + - "-localip" + - "{{ .Values.config.localDns }}" + {{- end }} + - "-conf" + - "/etc/Corefile" + - "-upstreamsvc" + - "{{ include "node-local-dns.fullname" . }}-upstream" + - "-skipteardown={{ .Values.config.skipTeardown }}" + - "-setupinterface={{ .Values.config.setupInterface }}" + - "-setupiptables={{ .Values.config.setupIptables }}" + {{- if .Values.config.setupIptables }} + securityContext: + {{- toYaml .Values.securityContext | nindent 10 }} + {{- end }} + ports: + - containerPort: 53 + name: dns + protocol: UDP + - containerPort: 53 + name: dns-tcp + protocol: TCP + - containerPort: 9253 + name: metrics + protocol: TCP + livenessProbe: + httpGet: + path: /health + port: {{ .Values.config.healthPort }} + initialDelaySeconds: 60 + timeoutSeconds: 5 + volumeMounts: + - mountPath: /run/xtables.lock + name: xtables-lock + readOnly: false + - name: config-volume + mountPath: /etc/coredns + - name: kube-dns-config + mountPath: /etc/kube-dns + volumes: + - name: xtables-lock + hostPath: + path: /run/xtables.lock + type: FileOrCreate + - name: kube-dns-config + configMap: + name: {{ include "node-local-dns.fullname" . }} + optional: true + - name: config-volume + configMap: + name: {{ include "node-local-dns.fullname" . }} + items: + - key: Corefile + path: Corefile.base diff --git a/charts/node-local-dns/templates/service-upstream.yaml b/charts/node-local-dns/templates/service-upstream.yaml new file mode 100644 index 0000000..4a485cd --- /dev/null +++ b/charts/node-local-dns/templates/service-upstream.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "node-local-dns.fullname" . }}-upstream + namespace: kube-system + labels: + {{- include "node-local-dns.labels" . | nindent 4 }} +spec: + ports: + - name: dns + port: 53 + protocol: UDP + targetPort: 53 + - name: dns-tcp + port: 53 + protocol: TCP + targetPort: 53 + selector: + k8s-app: kube-dns diff --git a/charts/node-local-dns/templates/service.yaml b/charts/node-local-dns/templates/service.yaml new file mode 100644 index 0000000..71c278b --- /dev/null +++ b/charts/node-local-dns/templates/service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "node-local-dns.fullname" . }} + namespace: kube-system + labels: + {{- include "node-local-dns.labels" . | nindent 4 }} + + {{- if and (not .Values.serviceMonitor.enabled) .Values.prometheusScraping.enabled }} + annotations: + prometheus.io/port: "9253" + prometheus.io/scrape: "true" + {{- end }} +spec: + clusterIP: None + ports: + - name: metrics + port: 9253 + targetPort: 9253 + selector: + k8s-app: {{ include "node-local-dns.fullname" . }} diff --git a/charts/node-local-dns/templates/serviceaccount.yaml b/charts/node-local-dns/templates/serviceaccount.yaml new file mode 100644 index 0000000..04a0cc6 --- /dev/null +++ b/charts/node-local-dns/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "node-local-dns.serviceAccountName" . }} + namespace: kube-system + labels: + {{- include "node-local-dns.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/node-local-dns/templates/servicemonitor.yaml b/charts/node-local-dns/templates/servicemonitor.yaml new file mode 100644 index 0000000..312da8e --- /dev/null +++ b/charts/node-local-dns/templates/servicemonitor.yaml @@ -0,0 +1,20 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "node-local-dns.fullname" . }} + namespace: kube-system + {{- if .Values.serviceMonitor.labels }} + labels: + {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} + {{- end }} +spec: + endpoints: + - port: metrics + namespaceSelector: + matchNames: + - kube-system + selector: + matchLabels: + k8s-app: {{ include "node-local-dns.name" . }} +{{- end -}} diff --git a/charts/node-local-dns/values.yaml b/charts/node-local-dns/values.yaml new file mode 100644 index 0000000..ebebfdd --- /dev/null +++ b/charts/node-local-dns/values.yaml @@ -0,0 +1,84 @@ +image: + repository: registry.k8s.io/dns/k8s-dns-node-cache + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +config: + # Internal k8s DNS domain + dnsDomain: "cluster.local" + + # Main coredns service (kube-dns) ip, used on iptables-mode. + dnsServer: "172.20.0.10" + + # Virtual IP to be used by ipvs mode, to be used as --cluster-dns, must not collide. + localDns: "169.254.20.25" + + # Set communication protocol. Options are `prefer_udp` or `force_tcp` + commProtocol: "force_tcp" + + # Port used for the health endpoint + healthPort: 8080 + + setupInterface: true + + setupIptables: true + + skipTeardown: false + + # Overrides the generated configuration with specified one. + customConfig: "" + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created. + create: true + # Annotations to add to the service account. + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template. + name: "" + +podAnnotations: {} + +podLabels: {} + +daemonsetAnnotations: {} + +daemonsetLabels: {} + +securityContext: + capabilities: + add: + - NET_ADMIN + +# https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md +serviceMonitor: + # Ensure that servicemonitor is created, this will disable prometheus annotations + enabled: false + labels: {} + +# https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md +dashboard: + enabled: false + # namespace where grafana sidecar is configured to look for dashboards. e.g. "monitoring" + namespace: kube-system + # label that grafana sidecar is configured to look for + label: grafana_dashboard + annotations: {} + +resources: + requests: + cpu: 25m + memory: 128Mi + limits: + memory: 128Mi + +affinity: {} + +imagePullSecrets: [] +# - name: "image-pull-secret" + +prometheusScraping: + enabled: true