Skip to content

Commit

Permalink
Merge pull request #10 from hoangmaihuy/fix-darwin-dns
Browse files Browse the repository at this point in the history
fix: DNS issue on MacOS Ventura
  • Loading branch information
keimoon authored Oct 27, 2022
2 parents 909df0f + 190101e commit c3debf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export KUBERNETES_VERSION=v1.22.6
export KUBERNETES_MINIKUBE_VERSION=v1.22.6
export DOCKER_VERSION=18.09.6
export IMLADRIS_VERSION=0.13.1
export COREDNS_VERSION=1.5.2
export COREDNS_VERSION=1.10.0
export EXTRA_NAT_NETWORK_NAME=minikube
export EXTRA_NAT_NETWORK_NET=10.0.72.0/24

Expand Down Expand Up @@ -90,14 +90,7 @@ function runCommandOnMinikube {

function modifyDNSDarwin {
networksetup -listallnetworkservices | grep -v '\*' | while read line; do
currentNS=`networksetup -getdnsservers "$line"`
if [[ $currentNS == There* ]]; then
currentNS=8.8.8.8
fi
if [[ $currentNS != *127.0.0.1* ]]; then
currentNS="127.0.0.1 $currentNS"
networksetup -setdnsservers "$line" $currentNS
fi
networksetup -setdnsservers "$line" 127.0.0.1
done
launchctl unload /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
defaults write /Library/Preferences/com.apple.mDNSResponder.plist StrictUnicastOrdering -bool YES
Expand Down Expand Up @@ -200,7 +193,7 @@ function cleanupDNSDarwin {
currentNS=`networksetup -getdnsservers "$line"`
if [[ $currentNS != There* ]] && [[ $currentNS == *$MINIKUBE_IP* ]] || [[ $currentNS == *127.0.0.1* ]]; then
currentNS=`echo $currentNS | sed 's/'$MINIKUBE_IP'//g' | sed 's/\s*//'`
currentNS=`echo $currentNS | sed 's/127.0.0.1//g' | sed 's/\s*//'`
currentNS=`echo $currentNS | sed 's/127.0.0.1/8.8.8.8/g' | sed 's/\s*//'`
networksetup -setdnsservers "$line" $currentNS
fi
currentSearch=`networksetup -getsearchdomains "$line"`
Expand Down
2 changes: 1 addition & 1 deletion lib/coredns-config/coredns.core
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
kube:53, kube-local.io:53 {
rewrite type ANY A
kubernetes kube kube-local.io {
resyncperiod 60s
endpoint https://192.168.144.100:8443
tls __HOME__/.minikube/profiles/minikube/apiserver.crt __HOME__/.minikube/profiles/minikube/apiserver.key __HOME__/.minikube/ca.crt
}
Expand All @@ -14,6 +13,7 @@ kube:53, kube-local.io:53 {
auto {
directory __HOME__/.anduin-kube/zones
}
forward . 8.8.8.8
log stdout {
class all
}
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/setup-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ function setupNetwork {
echo "Must be root"
exit 1
fi
cleanupDNS && cleanupRoute && modifyDNS && modifyRoute && startCoreDNS && startHealthz
cleanupDNS && cleanupRoute && startCoreDNS && modifyDNS && modifyRoute && startHealthz
}

0 comments on commit c3debf8

Please sign in to comment.