Skip to content

Commit

Permalink
Disable TCP early demux when pod-eni is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
SaranBalaji90 committed Sep 16, 2020
1 parent 0d3daa5 commit 70d7990
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
5 changes: 4 additions & 1 deletion config/master/aws-k8s-cni-cn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@
"name": "xtables-lock"
"hostNetwork": true
"initContainers":
- "image": "961992271922.dkr.ecr.cn-northwest-1.amazonaws.com.cn/amazon-k8s-cni-init:latest"
- "env":
- "name": "DISABLE_TCP_EARLY_DEMUX"
"value": "false"
"image": "961992271922.dkr.ecr.cn-northwest-1.amazonaws.com.cn/amazon-k8s-cni-init:latest"
"imagePullPolicy": "Always"
"name": "aws-vpc-cni-init"
"securityContext":
Expand Down
5 changes: 4 additions & 1 deletion config/master/aws-k8s-cni-us-gov-east-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@
"name": "xtables-lock"
"hostNetwork": true
"initContainers":
- "image": "151742754352.dkr.ecr.us-gov-east-1.amazonaws.com/amazon-k8s-cni-init:latest"
- "env":
- "name": "DISABLE_TCP_EARLY_DEMUX"
"value": "false"
"image": "151742754352.dkr.ecr.us-gov-east-1.amazonaws.com/amazon-k8s-cni-init:latest"
"imagePullPolicy": "Always"
"name": "aws-vpc-cni-init"
"securityContext":
Expand Down
5 changes: 4 additions & 1 deletion config/master/aws-k8s-cni-us-gov-west-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@
"name": "xtables-lock"
"hostNetwork": true
"initContainers":
- "image": "013241004608.dkr.ecr.us-gov-west-1.amazonaws.com/amazon-k8s-cni-init:latest"
- "env":
- "name": "DISABLE_TCP_EARLY_DEMUX"
"value": "false"
"image": "013241004608.dkr.ecr.us-gov-west-1.amazonaws.com/amazon-k8s-cni-init:latest"
"imagePullPolicy": "Always"
"name": "aws-vpc-cni-init"
"securityContext":
Expand Down
5 changes: 4 additions & 1 deletion config/master/aws-k8s-cni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@
"name": "xtables-lock"
"hostNetwork": true
"initContainers":
- "image": "602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni-init:latest"
- "env":
- "name": "DISABLE_TCP_EARLY_DEMUX"
"value": "false"
"image": "602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni-init:latest"
"imagePullPolicy": "Always"
"name": "aws-vpc-cni-init"
"securityContext":
Expand Down
5 changes: 5 additions & 0 deletions config/master/manifests.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ local awsnode = {
image: "%s/amazon-k8s-cni-init:%s" % [$.ecrRepo, $.version],
imagePullPolicy: "Always",
securityContext: {privileged: true},
env: [
{
name: "DISABLE_TCP_EARLY_DEMUX", value: "false",
},
],
volumeMounts: [
{mountPath: "/host/opt/cni/bin", name: "cni-bin-dir"},
],
Expand Down
9 changes: 8 additions & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-meta
HOST_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4)
PRIMARY_IF=$(ip -4 -o a | grep "$HOST_IP" | awk '{print $2}')
sysctl -w "net.ipv4.conf.$PRIMARY_IF.rp_filter=2"

cat "/proc/sys/net/ipv4/conf/$PRIMARY_IF/rp_filter"

# Configure tcp_early_demux to enable kubelet to pod-eni communication
# https://lwn.net/Articles/503420/ for background
if [ "${DISABLE_TCP_EARLY_DEMUX:-false}" == "true" ]; then
sysctl -w "net.ipv4.tcp_early_demux=0"
else
sysctl -w "net.ipv4.tcp_early_demux=1"
fi

echo "CNI init container done"

0 comments on commit 70d7990

Please sign in to comment.