Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b7df5cd2
Commit
b7df5cd2
authored
Jun 02, 2018
by
leigh schrandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: Set the kubelet `--resolv-conf` flag conditionally on init
Fixes
https://github.com/kubernetes/kubeadm/issues/845
parent
0ecfd343
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
32 deletions
+8
-32
BUILD
cmd/kubeadm/app/phases/kubelet/BUILD
+1
-0
flags.go
cmd/kubeadm/app/phases/kubelet/flags.go
+6
-1
BUILD
cmd/kubeadm/app/preflight/BUILD
+0
-1
checks.go
cmd/kubeadm/app/preflight/checks.go
+1
-30
No files found.
cmd/kubeadm/app/phases/kubelet/BUILD
View file @
b7df5cd2
...
...
@@ -19,6 +19,7 @@ go_library(
"//pkg/apis/rbac/v1:go_default_library",
"//pkg/kubelet/apis/kubeletconfig/scheme:go_default_library",
"//pkg/kubelet/apis/kubeletconfig/v1beta1:go_default_library",
"//pkg/util/procfs:go_default_library",
"//pkg/util/version:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
...
...
cmd/kubeadm/app/phases/kubelet/flags.go
View file @
b7df5cd2
...
...
@@ -28,6 +28,7 @@ import (
kubeadmapiv1alpha2
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
"k8s.io/kubernetes/pkg/util/procfs"
utilsexec
"k8s.io/utils/exec"
)
...
...
@@ -72,8 +73,12 @@ func buildKubeletArgMap(nodeRegOpts *kubeadmapi.NodeRegistrationOptions, registe
kubeletFlags
[
"register-with-taints"
]
=
strings
.
Join
(
taintStrs
,
","
)
}
if
pids
,
_
:=
procfs
.
PidOf
(
"systemd-resolved"
);
len
(
pids
)
>
0
{
// procfs.PidOf only returns an error if the regex is empty or doesn't compile, so we can ignore it
kubeletFlags
[
"resolv-conf"
]
=
"/run/systemd/resolve/resolv.conf"
}
// TODO: Pass through --hostname-override if a custom name is used?
// TODO: Check if `systemd-resolved` is running, and set `--resolv-conf` based on that
// TODO: Conditionally set `--cgroup-driver` to either `systemd` or `cgroupfs` for CRI other than Docker
return
kubeletFlags
...
...
cmd/kubeadm/app/preflight/BUILD
View file @
b7df5cd2
...
...
@@ -57,7 +57,6 @@ go_library(
"//pkg/registry/core/service/ipallocator:go_default_library",
"//pkg/util/initsystem:go_default_library",
"//pkg/util/ipvs:go_default_library",
"//pkg/util/procfs:go_default_library",
"//pkg/util/version:go_default_library",
"//pkg/version:go_default_library",
"//test/e2e_node/system:go_default_library",
...
...
cmd/kubeadm/app/preflight/checks.go
View file @
b7df5cd2
...
...
@@ -51,7 +51,6 @@ import (
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
"k8s.io/kubernetes/pkg/util/initsystem"
ipvsutil
"k8s.io/kubernetes/pkg/util/ipvs"
"k8s.io/kubernetes/pkg/util/procfs"
versionutil
"k8s.io/kubernetes/pkg/util/version"
kubeadmversion
"k8s.io/kubernetes/pkg/version"
"k8s.io/kubernetes/test/e2e_node/system"
...
...
@@ -830,33 +829,6 @@ func getEtcdVersionResponse(client *http.Client, url string, target interface{})
return
err
}
// ResolveCheck tests for potential issues related to the system resolver configuration
type
ResolveCheck
struct
{}
// Name returns label for ResolveCheck
func
(
ResolveCheck
)
Name
()
string
{
return
"Resolve"
}
// Check validates the system resolver configuration
func
(
ResolveCheck
)
Check
()
(
warnings
,
errors
[]
error
)
{
glog
.
V
(
1
)
.
Infoln
(
"validating the system resolver configuration"
)
warnings
=
[]
error
{}
// procfs.PidOf only returns an error if the string passed is empty
// or there is an issue compiling the regex, so we can ignore it here
pids
,
_
:=
procfs
.
PidOf
(
"systemd-resolved"
)
if
len
(
pids
)
>
0
{
warnings
=
append
(
warnings
,
fmt
.
Errorf
(
"systemd-resolved was detected, for cluster dns resolution to work "
+
"properly --resolv-conf=/run/systemd/resolve/resolv.conf must be set "
+
"for the kubelet. (/etc/systemd/system/kubelet.service.d/10-kubeadm.conf should be edited for this purpose)
\n
"
))
}
return
warnings
,
errors
}
// ImagePullCheck will pull container images used by kubeadm
type
ImagePullCheck
struct
{
Images
images
.
Images
...
...
@@ -1011,8 +983,7 @@ func addCommonChecks(execer utilsexec.Interface, cfg kubeadmapi.CommonConfigurat
InPathCheck
{
executable
:
"ethtool"
,
mandatory
:
false
,
exec
:
execer
},
InPathCheck
{
executable
:
"socat"
,
mandatory
:
false
,
exec
:
execer
},
InPathCheck
{
executable
:
"tc"
,
mandatory
:
false
,
exec
:
execer
},
InPathCheck
{
executable
:
"touch"
,
mandatory
:
false
,
exec
:
execer
},
ResolveCheck
{})
InPathCheck
{
executable
:
"touch"
,
mandatory
:
false
,
exec
:
execer
})
}
checks
=
append
(
checks
,
SystemVerificationCheck
{
CRISocket
:
cfg
.
GetCRISocket
()},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment