Skip to content

Commit 81bb82d

Browse files
authored
SYS-662 add node-local-dns cache from kubernetes distro (#223)
1 parent 11725e3 commit 81bb82d

6 files changed

Lines changed: 40 additions & 16 deletions

File tree

k8s/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $(STACKS)::
9595
.PHONY: envsubst imports install namespace_config node_labels \
9696
persistent remote_volumes secrets sops untaint_master
9797

98-
IMPORTS = cert-manager flannel
98+
IMPORTS = cert-manager flannel nodelocaldns
9999
INSTALL_YAML = $(basename $(wildcard install/*.yaml)) \
100100
$(addprefix imports/, $(IMPORTS))
101101
VOLUMES_YAML = $(basename $(wildcard volumes/*.yaml))
@@ -205,6 +205,15 @@ imports/cert-manager.yaml: imports/cert-manager-$(VERSION_CERT_MANAGER).yaml
205205
imports/cert-manager-$(VERSION_CERT_MANAGER).yaml:
206206
curl -sLo $@ https://github.com/jetstack/cert-manager/releases/download/v$(VERSION_CERT_MANAGER)/cert-manager.yaml
207207

208+
##########
209+
# node-local-dns
210+
##########
211+
imports/nodelocaldns.yaml: imports/nodelocaldns-$(VERSION_NODE_LOCAL_DNS).yaml
212+
ln -s $(notdir $<) $@
213+
imports/nodelocaldns-$(VERSION_NODE_LOCAL_DNS).yaml:
214+
curl -sLo $@ https://raw.githubusercontent.com/kubernetes/kubernetes/refs/tags/v$(VERSION_NODE_LOCAL_DNS)/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml
215+
sed -i -e "s/__PILLAR__LOCAL__DNS__/$(NODE_LOCAL_DNS_IP)/g; s/__PILLAR__DNS__DOMAIN__/cluster.local/g; s/__PILLAR__DNS__SERVER__/$(COREDNS_IP)/g" $@
216+
208217
##########
209218
# Add-ons
210219
##########

k8s/Makefile.vars

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export TZ ?= UTC
3232
export K8S_INGRESS_NGINX_IP ?= 10.101.1.2
3333
export AUTHELIA_IP ?= 10.101.1.5
3434
export MONITOR_EXT_IP ?= 192.168.1.20
35-
# export PROMETHEUS_IP ?= 10.101.1.21
36-
# export PROM_ALERT_IP ?= 10.101.1.22
35+
# export PROMETHEUS_IP ?= 10.101.1.21
36+
# export PROM_ALERT_IP ?= 10.101.1.22
3737
export RSYSLOGD_IP ?= 10.101.1.40
38+
export COREDNS_IP ?= 10.96.0.10
39+
export NODE_LOCAL_DNS_IP ?= 169.254.0.10
3840

3941
# Exposed nodePorts - install/ingress-nginx.yaml
4042
export NODEPORT_HTTP ?= 30080

k8s/Makefile.versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export VERSION_FLANNEL ?= 0.26.1
1010
export VERSION_HELM ?= 3.16.2
1111
export VERSION_INGRESS_NGINX ?= 1.13.1
1212
export VERSION_METRICS ?= 2.15.0
13+
export VERSION_NODE_LOCAL_DNS ?= 1.32.6
1314

1415
# Held back versions - more effort to upgrade
1516
export VERSION_CALICO ?= 3.16.5

k8s/helm/grafana/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
version: 0.1.8
1414
repository: https://instantlinux.github.io/docker-tools
1515
- name: prometheus
16-
version: 0.1.0
16+
version: 0.1.1
1717
repository: file://subcharts/prometheus
1818
condition: prometheus.enabled
1919
- name: alertmanager

k8s/helm/grafana/subcharts/prometheus/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ sources:
66
- https://github.com/instantlinux/docker-tools
77
- https://hub.docker.com/r/prom/prometheus
88
type: application
9-
version: 0.1.0
10-
appVersion: "v3.3.1"
9+
version: 0.1.1
10+
appVersion: "v3.5.0"
1111
dependencies:
1212
- name: chartlib
1313
version: 0.1.8

k8s/helm/grafana/subcharts/prometheus/values.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,9 @@ deployment:
1010
nodeSelector:
1111
service.prometheus: allow
1212
volumeMounts:
13-
- mountPath: /etc/prometheus/prometheus.yml
13+
- mountPath: /etc/prometheus
1414
name: config
1515
readOnly: true
16-
subPath: prometheus.yml
17-
- mountPath: /etc/prometheus/alert-rules.yml
18-
name: config
19-
readOnly: true
20-
subPath: alert-rules.yml
21-
- mountPath: /etc/prometheus/targets.json
22-
name: config
23-
readOnly: true
24-
subPath: targets.json
2516
- mountPath: /prometheus
2617
name: data
2718
volumes:
@@ -96,6 +87,15 @@ configmap:
9687
regex: ^myth.*
9788
target_label: alertSuppress
9889
replacement: true
90+
- job_name: dns-cache
91+
file_sd_configs:
92+
- files: [ k8s-workers.json ]
93+
relabel_configs:
94+
- source_labels: [__address__]
95+
target_label: instance
96+
- source_labels: [ __address__ ]
97+
target_label: __address__
98+
replacement: '${1}:9253'
9999
targets.json: |
100100
# Override the targets with your nodes list, comma-separated
101101
[
@@ -108,6 +108,18 @@ configmap:
108108
]
109109
}
110110
]
111+
k8s-workers.json: |
112+
# Override the targets with your k8s worker list, comma-separated
113+
[
114+
{
115+
"labels": {
116+
"job": "dns-cache"
117+
},
118+
"targets": [
119+
"localhost"
120+
]
121+
}
122+
]
111123
alert-rules.yml: |
112124
groups:
113125
- name: systems

0 commit comments

Comments
 (0)