Skip to content

Commit

Permalink
Moved to image 1.15.8, fixed profiling, improved README
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Yagofarov committed Feb 20, 2020
1 parent 2bebb89 commit 616357b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
3 changes: 2 additions & 1 deletion nodelocaldns/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
version: 0.1.4
version: 0.2.1
appVersion: "1.15.7"
name: node-local-dns
description: nodelocaldns is a local DNS cache for k8s pods
Expand All @@ -8,6 +8,7 @@ keywords:
- dns
- kubedns
- nodelocaldns
- node-cache
icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png
maintainers:
- name: Victor Yagofarov
Expand Down
18 changes: 15 additions & 3 deletions nodelocaldns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ helm template . -f dev_values.yaml

Deploy to Dev cluster:
```bash
kubectl config current-context
helm upgrade --install --force node-local-dns . --namespace kube-system --tiller-namespace kube-system --wait --timeout 180 --debug --values dev_values.yaml
```

Deploy to Prod cluster:
```bash
kubectl config current-context
helm upgrade --install --force node-local-dns . --namespace kube-system --tiller-namespace kube-system --wait --timeout 180 --debug --values prod_values.yaml
```

After successful deploy, change kubelet's `--cluster-dns` to value of chart's `localDNSAddress`. In Kubespray this value called `manual_dns_server` (also needs `dns_mode: manual`).
After successful deploy, change kubelet's `--cluster-dns` to value of chart's `localDNSAddress`. In the Kubespray this value called `manual_dns_server` (also needs `dns_mode: manual`).

## Configuration

Expand All @@ -34,9 +36,19 @@ After successful deploy, change kubelet's `--cluster-dns` to value of chart's `l
| `localDNSAddress` | IP address of node-local-dns pod (hostNetwork mode), must used at kubelet's flag | 169.254.25.10 |
| `clusterDNSAddress` | IP address of upstream cluster DNS service | 10.140.0.3 |
| `image.repository` | Docker image of node-local-dns | k8s.gcr.io/k8s-dns-node-cache |
| `image.tag` | Docker image's tag | 1.15.7 |
| `image.tag` | Docker image's tag | 1.15.8 |
| `clusterDNSSelector` | selector for cluster DNS pods (to reach them IP's) | k8s-app: coredns |
| `res` | node-local-dns pod's resources |
| `pprofPort` | enables pprof profiling at selected hostPort (nodelocaldns runs on hostNetwork) if your image built with pprof | 6068
| `profilingPort` | enables pprof profiling at selected hostPort (nodelocaldns runs on hostNetwork) if your image built with pprof. Don't use with images < 1.15.8 | 6068

## Profiling

```bash
kubectl -n kube-system port-forward node-local-dns-nzdsh 6068:6068
```

Access profiler with browser:
```
http://localhost:6068/debug/pprof/
```

7 changes: 4 additions & 3 deletions nodelocaldns/dev_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ clusterDNSAddress: "10.136.0.3"

image:
repository: "k8s.gcr.io/k8s-dns-node-cache"
tag: "1.15.7"
pullPolicy: Always
tag: "1.15.8"
pullPolicy: IfNotPresent

pprofPort: 6068
# supports only since 1.15.8
profilingPort: 6068

clusterDNSSelector:
k8s-app: coredns
Expand Down
7 changes: 4 additions & 3 deletions nodelocaldns/prod_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ clusterDNSAddress: "10.140.0.3"

image:
repository: "k8s.gcr.io/k8s-dns-node-cache"
tag: "1.15.7"
pullPolicy: Always
tag: "1.15.8"
pullPolicy: IfNotPresent

pprofPort: 6068
# supports only since 1.15.8
profilingPort: 6068

clusterDNSSelector:
k8s-app: coredns
Expand Down
5 changes: 5 additions & 0 deletions nodelocaldns/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ data:
forward . {{ .Values.clusterDNSAddress }} {
force_tcp
}
{{- if .Values.profilingPort }}
pprof :{{ .Values.profilingPort }} {
block
}
{{- end }}
prometheus :9253
}
api.telegram.org:53 {
Expand Down
7 changes: 4 additions & 3 deletions nodelocaldns/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ spec:
- name: node-cache
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- toYaml .Values.res | trim | nindent 8 }}
# "-kubednscm", "/etc/coredns" -- enables configmap reloading feature
args: [ "-localip", "{{ .Values.localDNSAddress }}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream", "-kubednscm", "/etc/coredns" ]
{{- toYaml .Values.res | trim | nindent 8 }}
securityContext:
privileged: true
ports:
Expand All @@ -52,8 +53,8 @@ spec:
- containerPort: 9253
name: metrics
protocol: TCP
{{- if .Values.pprofPort }}
- containerPort: {{ .Values.pprofPort }}
{{- if .Values.profilingPort }}
- containerPort: {{ .Values.profilingPort }}
name: pprof
protocol: TCP
{{- end }}
Expand Down

0 comments on commit 616357b

Please sign in to comment.