Skip to content

Commit

Permalink
Merge pull request #4350 from CecileRobertMichon/remove-ipv6-workaround
Browse files Browse the repository at this point in the history
Remove DNS workaround for ipv6 templates
  • Loading branch information
k8s-ci-robot authored Dec 12, 2023
2 parents 7a44c7c + adf2190 commit 0ccc4d3
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 126 deletions.
8 changes: 0 additions & 8 deletions docs/book/src/topics/ipv6.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ The reference [ipv6 flavor](https://raw.githubusercontent.com/kubernetes-sigs/cl
- Kubernetes version needs to be 1.18+
- The :53 port needs to be free on the host so coredns can use it. In 18.04, systemd-resolved uses the port :53 on the host and is used by default for DNS. This causes the coredns pods to crash for single stack IPv6 with bind address already in use as coredns pods are run on hostNetwork to leverage the host routes for DNS resolution. This is done by running the following commands in postKubeadmCommands:
```yaml
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf
/etc/resolv.conf
- systemctl restart systemd-resolved
```
- The coredns pod needs to run on the host network, so it can leverage host routes for the v4 network to do the DNS resolution. The workaround is to edit the coredns deployment and add `hostNetwork: true`:
```bash
kubectl patch deploy/coredns -n kube-system --type=merge -p '{"spec": {"template": {"spec":{"hostNetwork": true}}}}'
Expand Down
11 changes: 1 addition & 10 deletions templates/cluster-template-dual-stack.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions templates/cluster-template-ipv6.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions templates/flavors/dual-stack/machine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ metadata:
spec:
template:
spec:
postKubeadmCommands:
# This frees up :53 on the host for the coredns pods
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- systemctl restart systemd-resolved containerd
joinConfiguration:
nodeRegistration:
name: '{{ ds.meta_data["local_hostname"] }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
kubeadmConfigSpec:
postKubeadmCommands:
# This frees up :53 on the host for the coredns pods
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- systemctl restart systemd-resolved containerd
initConfiguration:
nodeRegistration:
name: '{{ ds.meta_data["local_hostname"] }}'
Expand Down
5 changes: 0 additions & 5 deletions templates/flavors/ipv6/machine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ metadata:
spec:
template:
spec:
postKubeadmCommands:
# This frees up :53 on the host for the coredns pods
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- systemctl restart systemd-resolved containerd
joinConfiguration:
nodeRegistration:
name: '{{ ds.meta_data["local_hostname"] }}'
Expand Down
5 changes: 0 additions & 5 deletions templates/flavors/ipv6/patches/kubeadm-controlplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
kubeadmConfigSpec:
postKubeadmCommands:
# This frees up :53 on the host for the coredns pods
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- systemctl restart systemd-resolved containerd
initConfiguration:
nodeRegistration:
name: '{{ ds.meta_data["local_hostname"] }}'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions templates/test/ci/cluster-template-prow-ci-version-ipv6.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions templates/test/ci/cluster-template-prow-dual-stack.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions templates/test/ci/cluster-template-prow-ipv6.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,3 @@ spec:
template:
spec:
enableIPForwarding: true
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
postKubeadmCommands:
# This frees up :53 on the host for the coredns pods
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- systemctl restart systemd-resolved containerd
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ metadata:
spec:
template:
spec:
postKubeadmCommands:
# This frees up :53 on the host for the coredns pods
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- systemctl restart systemd-resolved containerd
joinConfiguration:
nodeRegistration:
name: '{{ ds.meta_data["local_hostname"] }}'
Expand Down
5 changes: 0 additions & 5 deletions templates/test/ci/prow-dual-stack/machine-pool-dualstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,3 @@ spec:
cloud-provider: azure
cluster-dns: '[fd00::10]'
name: '{{ ds.meta_data["local_hostname"] }}'
postKubeadmCommands:
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf
/etc/resolv.conf
- systemctl restart systemd-resolved containerd
6 changes: 1 addition & 5 deletions templates/test/ci/prow-ipv6/machine-pool-ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,4 @@ spec:
cloud-provider: azure
cluster-dns: '[fd00::10]'
name: '{{ ds.meta_data["local_hostname"] }}'
postKubeadmCommands:
- echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf
/etc/resolv.conf
- systemctl restart systemd-resolved containerd

0 comments on commit 0ccc4d3

Please sign in to comment.