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
0d76df93
Commit
0d76df93
authored
Nov 09, 2021
by
Manuel Buil
Committed by
Brad Davidson
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow svclb pod to enable ipv6 forwarding
Signed-off-by:
Manuel Buil
<
mbuil@suse.com
>
parent
53b10471
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
0 deletions
+33
-0
config.go
pkg/agent/config/config.go
+1
-0
run.go
pkg/agent/run.go
+1
-0
agent.go
pkg/cli/cmds/agent.go
+1
-0
server.go
pkg/cli/server/server.go
+1
-0
agent_linux.go
pkg/daemons/agent/agent_linux.go
+5
-0
types.go
pkg/daemons/config/types.go
+3
-0
controller.go
pkg/servicelb/controller.go
+21
-0
No files found.
pkg/agent/config/config.go
View file @
0d76df93
...
@@ -558,6 +558,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
...
@@ -558,6 +558,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
nodeConfig
.
AgentConfig
.
Rootless
=
envInfo
.
Rootless
nodeConfig
.
AgentConfig
.
Rootless
=
envInfo
.
Rootless
nodeConfig
.
AgentConfig
.
PodManifests
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
DefaultPodManifestPath
)
nodeConfig
.
AgentConfig
.
PodManifests
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
DefaultPodManifestPath
)
nodeConfig
.
AgentConfig
.
ProtectKernelDefaults
=
envInfo
.
ProtectKernelDefaults
nodeConfig
.
AgentConfig
.
ProtectKernelDefaults
=
envInfo
.
ProtectKernelDefaults
nodeConfig
.
AgentConfig
.
DisableServiceLB
=
envInfo
.
DisableServiceLB
if
err
:=
validateNetworkConfig
(
nodeConfig
);
err
!=
nil
{
if
err
:=
validateNetworkConfig
(
nodeConfig
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/agent/run.go
View file @
0d76df93
...
@@ -65,6 +65,7 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
...
@@ -65,6 +65,7 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
return
errors
.
Wrap
(
err
,
"failed to validate kube-proxy conntrack configuration"
)
return
errors
.
Wrap
(
err
,
"failed to validate kube-proxy conntrack configuration"
)
}
}
syssetup
.
Configure
(
enableIPv6
,
conntrackConfig
)
syssetup
.
Configure
(
enableIPv6
,
conntrackConfig
)
nodeConfig
.
AgentConfig
.
EnableIPv6
=
enableIPv6
if
err
:=
setupCriCtlConfig
(
cfg
,
nodeConfig
);
err
!=
nil
{
if
err
:=
setupCriCtlConfig
(
cfg
,
nodeConfig
);
err
!=
nil
{
return
err
return
err
...
...
pkg/cli/cmds/agent.go
View file @
0d76df93
...
@@ -16,6 +16,7 @@ type Agent struct {
...
@@ -16,6 +16,7 @@ type Agent struct {
ServerURL
string
ServerURL
string
APIAddressCh
chan
string
APIAddressCh
chan
string
DisableLoadBalancer
bool
DisableLoadBalancer
bool
DisableServiceLB
bool
ETCDAgent
bool
ETCDAgent
bool
LBServerPort
int
LBServerPort
int
ResolvConf
string
ResolvConf
string
...
...
pkg/cli/server/server.go
View file @
0d76df93
...
@@ -471,6 +471,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
...
@@ -471,6 +471,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
agentConfig
.
ServerURL
=
url
agentConfig
.
ServerURL
=
url
agentConfig
.
Token
=
token
agentConfig
.
Token
=
token
agentConfig
.
DisableLoadBalancer
=
!
serverConfig
.
ControlConfig
.
DisableAPIServer
agentConfig
.
DisableLoadBalancer
=
!
serverConfig
.
ControlConfig
.
DisableAPIServer
agentConfig
.
DisableServiceLB
=
serverConfig
.
DisableServiceLB
agentConfig
.
ETCDAgent
=
serverConfig
.
ControlConfig
.
DisableAPIServer
agentConfig
.
ETCDAgent
=
serverConfig
.
ControlConfig
.
DisableAPIServer
agentConfig
.
ClusterReset
=
serverConfig
.
ControlConfig
.
ClusterReset
agentConfig
.
ClusterReset
=
serverConfig
.
ControlConfig
.
ClusterReset
...
...
pkg/daemons/agent/agent_linux.go
View file @
0d76df93
...
@@ -168,5 +168,10 @@ func kubeletArgs(cfg *config.Agent) map[string]string {
...
@@ -168,5 +168,10 @@ func kubeletArgs(cfg *config.Agent) map[string]string {
if
cfg
.
ProtectKernelDefaults
{
if
cfg
.
ProtectKernelDefaults
{
argsMap
[
"protect-kernel-defaults"
]
=
"true"
argsMap
[
"protect-kernel-defaults"
]
=
"true"
}
}
if
!
cfg
.
DisableServiceLB
&&
cfg
.
EnableIPv6
{
argsMap
[
"allowed-unsafe-sysctls"
]
=
"net.ipv6.conf.all.forwarding"
}
return
argsMap
return
argsMap
}
}
pkg/daemons/config/types.go
View file @
0d76df93
...
@@ -99,6 +99,8 @@ type Agent struct {
...
@@ -99,6 +99,8 @@ type Agent struct {
DisableNPC
bool
DisableNPC
bool
Rootless
bool
Rootless
bool
ProtectKernelDefaults
bool
ProtectKernelDefaults
bool
DisableServiceLB
bool
EnableIPv6
bool
}
}
// CriticalControlArgs contains parameters that all control plane nodes in HA must share
// CriticalControlArgs contains parameters that all control plane nodes in HA must share
...
@@ -132,6 +134,7 @@ type Control struct {
...
@@ -132,6 +134,7 @@ type Control struct {
AgentToken
string
`json:"-"`
AgentToken
string
`json:"-"`
Token
string
`json:"-"`
Token
string
`json:"-"`
ServiceNodePortRange
*
utilnet
.
PortRange
ServiceNodePortRange
*
utilnet
.
PortRange
DisableServiceLB
bool
KubeConfigOutput
string
KubeConfigOutput
string
KubeConfigMode
string
KubeConfigMode
string
DataDir
string
DataDir
string
...
...
pkg/servicelb/controller.go
View file @
0d76df93
...
@@ -350,6 +350,14 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
...
@@ -350,6 +350,14 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
name
:=
fmt
.
Sprintf
(
"svclb-%s"
,
svc
.
Name
)
name
:=
fmt
.
Sprintf
(
"svclb-%s"
,
svc
.
Name
)
oneInt
:=
intstr
.
FromInt
(
1
)
oneInt
:=
intstr
.
FromInt
(
1
)
// If ipv6 is present, we must enable ipv6 forwarding in the manifest
var
ipv6Switch
bool
for
_
,
ipFamily
:=
range
svc
.
Spec
.
IPFamilies
{
if
ipFamily
==
core
.
IPv6Protocol
{
ipv6Switch
=
true
}
}
ds
:=
&
apps
.
DaemonSet
{
ds
:=
&
apps
.
DaemonSet
{
ObjectMeta
:
meta
.
ObjectMeta
{
ObjectMeta
:
meta
.
ObjectMeta
{
Name
:
name
,
Name
:
name
,
...
@@ -394,6 +402,19 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
...
@@ -394,6 +402,19 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
},
},
}
}
if
ipv6Switch
{
// Add security context to enable ipv6 forwarding
securityContext
:=
&
core
.
PodSecurityContext
{
Sysctls
:
[]
core
.
Sysctl
{
{
Name
:
"net.ipv6.conf.all.forwarding"
,
Value
:
"1"
,
},
},
}
ds
.
Spec
.
Template
.
Spec
.
SecurityContext
=
securityContext
}
for
_
,
port
:=
range
svc
.
Spec
.
Ports
{
for
_
,
port
:=
range
svc
.
Spec
.
Ports
{
portName
:=
fmt
.
Sprintf
(
"lb-port-%d"
,
port
.
Port
)
portName
:=
fmt
.
Sprintf
(
"lb-port-%d"
,
port
.
Port
)
container
:=
core
.
Container
{
container
:=
core
.
Container
{
...
...
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