Skip to content

Commit

Permalink
support CoreDNS use host network and config dns port (#10617)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxu623 authored Nov 17, 2023
1 parent f46910e commit bc5b38a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions roles/kubernetes-apps/ansible/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ coredns_ordinal_suffix: ""
coredns_deployment_nodeselector: "kubernetes.io/os: linux"
coredns_default_zone_cache_block: |
cache 30
coredns_host_network: false
coredns_port: 53
# coredns_additional_configs adds any extra configuration to coredns
# coredns_additional_configs: |
# whoami
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ data:
}
{% endfor %}
{% endif %}
.:53 {
.:{{ coredns_port }} {
{% if coredns_additional_configs is defined %}
{{ coredns_additional_configs | indent(width=8, first=False) }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spec:
annotations:
createdby: 'kubespray'
spec:
hostNetwork: {{ coredns_host_network | default(false) }}
securityContext:
seccompProfile:
type: RuntimeDefault
Expand Down Expand Up @@ -75,10 +76,10 @@ spec:
- name: config-volume
mountPath: /etc/coredns
ports:
- containerPort: 53
- containerPort: {{ coredns_port }}
name: dns
protocol: UDP
- containerPort: 53
- containerPort: {{ coredns_port }}
name: dns-tcp
protocol: TCP
- containerPort: 9153
Expand Down
2 changes: 2 additions & 0 deletions roles/kubernetes-apps/ansible/templates/coredns-svc.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ spec:
- name: dns
port: 53
protocol: UDP
targetPort: "dns"
- name: dns-tcp
port: 53
protocol: TCP
targetPort: "dns-tcp"
- name: metrics
port: 9153
protocol: TCP

0 comments on commit bc5b38a

Please sign in to comment.