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
5b456972
Unverified
Commit
5b456972
authored
Nov 17, 2021
by
Manuel Buil
Committed by
GitHub
Nov 17, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4519 from manuelbuil/backport_ipv6_rh_121
[Release 1.21] Allow svclb pod to enable ipv6 forwarding
parents
c096668c
fd71ed9f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
0 deletions
+32
-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.go
pkg/daemons/agent/agent.go
+4
-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 @
5b456972
...
...
@@ -540,6 +540,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
nodeConfig
.
AgentConfig
.
Rootless
=
envInfo
.
Rootless
nodeConfig
.
AgentConfig
.
PodManifests
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
DefaultPodManifestPath
)
nodeConfig
.
AgentConfig
.
ProtectKernelDefaults
=
envInfo
.
ProtectKernelDefaults
nodeConfig
.
AgentConfig
.
DisableServiceLB
=
envInfo
.
DisableServiceLB
if
err
:=
validateNetworkConfig
(
nodeConfig
);
err
!=
nil
{
return
nil
,
err
...
...
pkg/agent/run.go
View file @
5b456972
...
...
@@ -96,6 +96,7 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
return
errors
.
Wrap
(
err
,
"failed to validate kube-proxy conntrack configuration"
)
}
syssetup
.
Configure
(
enableIPv6
,
conntrackConfig
)
nodeConfig
.
AgentConfig
.
EnableIPv6
=
enableIPv6
if
err
:=
setupCriCtlConfig
(
cfg
,
nodeConfig
);
err
!=
nil
{
return
err
...
...
pkg/cli/cmds/agent.go
View file @
5b456972
...
...
@@ -16,6 +16,7 @@ type Agent struct {
ServerURL
string
APIAddressCh
chan
string
DisableLoadBalancer
bool
DisableServiceLB
bool
ETCDAgent
bool
LBServerPort
int
ResolvConf
string
...
...
pkg/cli/server/server.go
View file @
5b456972
...
...
@@ -451,6 +451,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
agentConfig
.
ServerURL
=
url
agentConfig
.
Token
=
token
agentConfig
.
DisableLoadBalancer
=
!
serverConfig
.
ControlConfig
.
DisableAPIServer
agentConfig
.
DisableServiceLB
=
serverConfig
.
DisableServiceLB
agentConfig
.
ETCDAgent
=
serverConfig
.
ControlConfig
.
DisableAPIServer
agentConfig
.
ClusterReset
=
serverConfig
.
ControlConfig
.
ClusterReset
...
...
pkg/daemons/agent/agent.go
View file @
5b456972
...
...
@@ -190,6 +190,10 @@ func startKubelet(cfg *config.Agent) error {
argsMap
[
"protect-kernel-defaults"
]
=
"true"
}
if
!
cfg
.
DisableServiceLB
&&
cfg
.
EnableIPv6
{
argsMap
[
"allowed-unsafe-sysctls"
]
=
"net.ipv6.conf.all.forwarding"
}
args
:=
config
.
GetArgsList
(
argsMap
,
cfg
.
ExtraKubeletArgs
)
logrus
.
Infof
(
"Running kubelet %s"
,
config
.
ArgString
(
args
))
...
...
pkg/daemons/config/types.go
View file @
5b456972
...
...
@@ -100,6 +100,8 @@ type Agent struct {
DisableKubeProxy
bool
Rootless
bool
ProtectKernelDefaults
bool
DisableServiceLB
bool
EnableIPv6
bool
}
type
Control
struct
{
...
...
@@ -122,6 +124,7 @@ type Control struct {
ClusterDNS
net
.
IP
ClusterDNSs
[]
net
.
IP
ClusterDomain
string
DisableServiceLB
bool
NoCoreDNS
bool
KubeConfigOutput
string
KubeConfigMode
string
...
...
pkg/servicelb/controller.go
View file @
5b456972
...
...
@@ -350,6 +350,14 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
name
:=
fmt
.
Sprintf
(
"svclb-%s"
,
svc
.
Name
)
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
{
ObjectMeta
:
meta
.
ObjectMeta
{
Name
:
name
,
...
...
@@ -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
{
portName
:=
fmt
.
Sprintf
(
"lb-port-%d"
,
port
.
Port
)
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