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
510ce3ce
Commit
510ce3ce
authored
May 15, 2018
by
Alexander Kanevskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm preflight check for IPv4 and IPv6 forwarding
Fixes: kubernetes/kubeadm#580
parent
d2952c0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
checks.go
cmd/kubeadm/app/preflight/checks.go
+12
-6
No files found.
cmd/kubeadm/app/preflight/checks.go
View file @
510ce3ce
...
...
@@ -60,6 +60,8 @@ import (
const
(
bridgenf
=
"/proc/sys/net/bridge/bridge-nf-call-iptables"
bridgenf6
=
"/proc/sys/net/bridge/bridge-nf-call-ip6tables"
ipv4Forward
=
"/proc/sys/net/ipv4/ip_forward"
ipv6DefaultForwarding
=
"/proc/sys/net/ipv6/conf/default/forwarding"
externalEtcdRequestTimeout
=
time
.
Duration
(
10
*
time
.
Second
)
externalEtcdRequestRetries
=
3
externalEtcdRequestInterval
=
time
.
Duration
(
5
*
time
.
Second
)
...
...
@@ -901,6 +903,7 @@ func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.MasterConfi
if
ip
.
To4
()
==
nil
&&
ip
.
To16
()
!=
nil
{
checks
=
append
(
checks
,
FileContentCheck
{
Path
:
bridgenf6
,
Content
:
[]
byte
{
'1'
}},
FileContentCheck
{
Path
:
ipv6DefaultForwarding
,
Content
:
[]
byte
{
'1'
}},
)
}
}
...
...
@@ -922,25 +925,27 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.NodeConfigura
}
checks
=
addCommonChecks
(
execer
,
cfg
,
checks
)
var
bridgenf6Check
Checker
addIPv6Checks
:=
false
for
_
,
server
:=
range
cfg
.
DiscoveryTokenAPIServers
{
ipstr
,
_
,
err
:=
net
.
SplitHostPort
(
server
)
if
err
==
nil
{
checks
=
append
(
checks
,
HTTPProxyCheck
{
Proto
:
"https"
,
Host
:
ipstr
},
)
if
bridgenf6Check
==
nil
{
if
!
addIPv6Checks
{
if
ip
:=
net
.
ParseIP
(
ipstr
);
ip
!=
nil
{
if
ip
.
To4
()
==
nil
&&
ip
.
To16
()
!=
nil
{
// This check should be added only once
bridgenf6Check
=
FileContentCheck
{
Path
:
bridgenf6
,
Content
:
[]
byte
{
'1'
}}
addIPv6Checks
=
true
}
}
}
}
}
if
bridgenf6Check
!=
nil
{
checks
=
append
(
checks
,
bridgenf6Check
)
if
addIPv6Checks
{
checks
=
append
(
checks
,
FileContentCheck
{
Path
:
bridgenf6
,
Content
:
[]
byte
{
'1'
}},
FileContentCheck
{
Path
:
ipv6DefaultForwarding
,
Content
:
[]
byte
{
'1'
}},
)
}
return
RunChecks
(
checks
,
os
.
Stderr
,
ignorePreflightErrors
)
...
...
@@ -969,6 +974,7 @@ func addCommonChecks(execer utilsexec.Interface, cfg kubeadmapi.CommonConfigurat
if
runtime
.
GOOS
==
"linux"
{
checks
=
append
(
checks
,
FileContentCheck
{
Path
:
bridgenf
,
Content
:
[]
byte
{
'1'
}},
FileContentCheck
{
Path
:
ipv4Forward
,
Content
:
[]
byte
{
'1'
}},
SwapCheck
{},
InPathCheck
{
executable
:
"ip"
,
mandatory
:
true
,
exec
:
execer
},
InPathCheck
{
executable
:
"iptables"
,
mandatory
:
true
,
exec
:
execer
},
...
...
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