@@ -54,6 +54,7 @@ import (
54
54
authzmodes "k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
55
55
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
56
56
"k8s.io/kubernetes/pkg/util/initsystem"
57
+ "k8s.io/kubernetes/pkg/util/procfs"
57
58
versionutil "k8s.io/kubernetes/pkg/util/version"
58
59
kubeadmversion "k8s.io/kubernetes/pkg/version"
59
60
"k8s.io/kubernetes/test/e2e_node/system"
@@ -867,6 +868,33 @@ func getEtcdVersionResponse(client *http.Client, url string, target interface{})
867
868
return err
868
869
}
869
870
871
+ // ResolveCheck tests for potential issues related to the system resolver configuration
872
+ type ResolveCheck struct {}
873
+
874
+ // Name returns label for ResolveCheck
875
+ func (ResolveCheck ) Name () string {
876
+ return "Resolve"
877
+ }
878
+
879
+ // Check validates the system resolver configuration
880
+ func (ResolveCheck ) Check () (warnings , errors []error ) {
881
+ glog .V (1 ).Infoln ("validating the system resolver configuration" )
882
+
883
+ warnings = []error {}
884
+
885
+ // procfs.PidOf only returns an error if the string passed is empty
886
+ // or there is an issue compiling the regex, so we can ignore it here
887
+ pids , _ := procfs .PidOf ("systemd-resolved" )
888
+ if len (pids ) > 0 {
889
+ warnings = append (warnings , fmt .Errorf (
890
+ "systemd-resolved was detected, for cluster dns resolution to work " +
891
+ "properly --resolv-conf=/run/systemd/resolve/resolv.conf must be set " +
892
+ "for the kubelet. (/etc/systemd/system/kubelet.service.d/10-kubeadm.conf should be edited for this purpose)\n " ))
893
+ }
894
+
895
+ return warnings , errors
896
+ }
897
+
870
898
// RunInitMasterChecks executes all individual, applicable to Master node checks.
871
899
func RunInitMasterChecks (execer utilsexec.Interface , cfg * kubeadmapi.MasterConfiguration , ignorePreflightErrors sets.String ) error {
872
900
// First, check if we're root separately from the other preflight checks and fail fast
@@ -1010,7 +1038,8 @@ func addCommonChecks(execer utilsexec.Interface, cfg kubeadmapi.CommonConfigurat
1010
1038
InPathCheck {executable : "socat" , mandatory : false , exec : execer },
1011
1039
InPathCheck {executable : "tc" , mandatory : false , exec : execer },
1012
1040
InPathCheck {executable : "touch" , mandatory : false , exec : execer },
1013
- criCtlChecker )
1041
+ criCtlChecker ,
1042
+ ResolveCheck {})
1014
1043
}
1015
1044
checks = append (checks ,
1016
1045
SystemVerificationCheck {CRISocket : cfg .GetCRISocket ()},
0 commit comments