diff --git a/scripts/minikube.sh b/scripts/minikube.sh index d645d22ca..37664ed1f 100755 --- a/scripts/minikube.sh +++ b/scripts/minikube.sh @@ -78,8 +78,19 @@ fi K8S_FEATURE_GATES=${K8S_FEATURE_GATES:-"BlockVolume=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true,ExpandCSIVolumes=true"} #extra-config for kube https://minikube.sigs.k8s.io/docs/reference/configuration/kubernetes/ -EXTRA_CONFIG=${EXTRA_CONFIG:-"--extra-config=apiserver.enable-admission-plugins=PodSecurityPolicy \ - --extra-config=kubelet.resolv-conf=/run/systemd/resolve/resolv.conf"} +EXTRA_CONFIG=${EXTRA_CONFIG:-"--extra-config=apiserver.enable-admission-plugins=PodSecurityPolicy"} + +# kubelet.resolv-conf needs to point to a file, not a symlink +# the default minikube VM has /etc/resolv.conf -> /run/systemd/resolve/resolv.conf +RESOLV_CONF='/run/systemd/resolve/resolv.conf' +if [[ "${VM_DRIVER}" == "none" ]] && [[ ! -e "${RESOLV_CONF}" ]]; then + # in case /run/systemd/resolve/resolv.conf does not exist, use the + # standard /etc/resolv.conf (with symlink resolved) + RESOLV_CONF="$(readlink -f /etc/resolv.conf)" +fi +# TODO: this might overload --extra-config=kubelet.resolv-conf in case the +# caller did set EXTRA_CONFIG in the environment +EXTRA_CONFIG="${EXTRA_CONFIG} --extra-config=kubelet.resolv-conf=${RESOLV_CONF}" #extra Rook configuration ROOK_BLOCK_POOL_NAME=${ROOK_BLOCK_POOL_NAME:-"newrbdpool"}