openstack-helm-infra/roles/deploy-env/tasks/coredns_resolver.yaml
Vladimir Kozhukalov cfed816a9a Fix coredns resolver
Forward requests for unknown names to 8.8.8.8

NOTE: Temporarily disable DPDK job which turned to
be incompatible with this PR
https://review.opendev.org/c/openstack/openstack-helm/+/914399
It wasn't tested with the DPDK job.

Change-Id: I936fb1032a736f7b09ad50b749d37095cce4c392
2024-03-28 20:34:23 -05:00

63 lines
1.8 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: Enable recursive queries for coredns
become: false
shell: |
tee > /tmp/coredns_configmap.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
header {
response set ra
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . 8.8.8.8 {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
EOF
kubectl apply -f /tmp/coredns_configmap.yaml
kubectl rollout restart -n kube-system deployment/coredns
kubectl rollout status -n kube-system deployment/coredns
when: inventory_hostname in (groups['primary'] | default([]))
- name: Use coredns as default DNS resolver
copy:
src: files/cluster_resolv.conf
dest: /etc/resolv.conf
owner: root
group: root
mode: 0644
when: inventory_hostname in (groups['k8s_cluster'] | default([]))
...