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
f66d4e18
Commit
f66d4e18
authored
Apr 29, 2018
by
Rene Treffer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always masquerade node-originating traffic with a service VIP source ip
parent
481b2dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
proxier.go
pkg/proxy/ipvs/proxier.go
+11
-3
No files found.
pkg/proxy/ipvs/proxier.go
View file @
f66d4e18
...
...
@@ -1218,17 +1218,25 @@ func (proxier *Proxier) writeIptablesRules() {
"-A"
,
string
(
kubeServicesChain
),
"-m"
,
"comment"
,
"--comment"
,
proxier
.
ipsetList
[
kubeClusterIPSet
]
.
getComment
(),
"-m"
,
"set"
,
"--match-set"
,
kubeClusterIPSet
,
"dst,dst"
,
)
if
proxier
.
masqueradeAll
{
writeLine
(
proxier
.
natRules
,
append
(
args
,
"-j"
,
string
(
KubeMarkMasqChain
))
...
)
writeLine
(
proxier
.
natRules
,
append
(
args
,
"
dst,dst"
,
"
-j"
,
string
(
KubeMarkMasqChain
))
...
)
}
else
if
len
(
proxier
.
clusterCIDR
)
>
0
{
// This masquerades off-cluster traffic to a service VIP. The idea
// is that you can establish a static route for your Service range,
// routing to any node, and that node will bridge into the Service
// for you. Since that might bounce off-node, we masquerade here.
// If/when we support "Local" policy for VIPs, we should update this.
writeLine
(
proxier
.
natRules
,
append
(
args
,
"! -s"
,
proxier
.
clusterCIDR
,
"-j"
,
string
(
KubeMarkMasqChain
))
...
)
writeLine
(
proxier
.
natRules
,
append
(
args
,
"dst,dst"
,
"! -s"
,
proxier
.
clusterCIDR
,
"-j"
,
string
(
KubeMarkMasqChain
))
...
)
}
else
{
// Masquerade all OUTPUT traffic coming from a service ip.
// The kube dummy interface has all service VIPs assigned which
// results in the service VIP being picked as the source IP to reach
// a VIP. This leads to a connection from VIP:<random port> to
// VIP:<service port>.
// Always masquerading OUTPUT (node-originating) traffic with a VIP
// source ip and service port destination fixes the outgoing connections.
writeLine
(
proxier
.
natRules
,
append
(
args
,
"src,dst"
,
"-j"
,
string
(
KubeMarkMasqChain
))
...
)
}
}
...
...
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