Skip to content

Commit f6c69bb

Browse files
authored
Merge pull request #17935 from rifelpet/automated-cherry-pick-of-#17867-#17882-#17933-origin-release-1.34
Automated cherry pick of #17867: Use a different systemd-networkd configuration for AL2023 #17882: Disable cloud-init network hotplug on Ubuntu 24.04 for Cilium and Ama… #17933: Set MACAddressPolicy=none for AWS VPC CNI on AL2023
2 parents a12bb33 + a5b2eb7 commit f6c69bb

File tree

2 files changed

+55
-3
lines changed

2 files changed

+55
-3
lines changed

nodeup/pkg/model/networking/amazon-vpc-routed-eni.go

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ ManageForeignRoutingPolicyRules=no
6868
})
6969
}
7070

71-
// Running Amazon VPC CNI on Ubuntu 22.04+ or any version of al2023 requires
71+
// Running Amazon VPC CNI on Ubuntu 22.04+ and AL2023 requires
7272
// setting MACAddressPolicy to `none` (ref: https://github.com/aws/amazon-vpc-cni-k8s/issues/2103
7373
// & https://github.com/aws/amazon-vpc-cni-k8s/issues/2839
7474
// & https://github.com/kubernetes/kops/issues/16255)
75-
if (b.Distribution.IsUbuntu() && b.Distribution.Version() >= 22.04) ||
76-
b.Distribution == distributions.DistributionAmazonLinux2023 {
75+
if b.Distribution.IsUbuntu() && b.Distribution.Version() >= 22.04 || b.Distribution == distributions.DistributionAmazonLinux2023 {
7776
contents := `
7877
[Match]
7978
OriginalName=*
@@ -92,5 +91,44 @@ MACAddressPolicy=none
9291
})
9392

9493
}
94+
95+
// Running Amazon VPC CNI on al2023 requires setting Unmanaged to `yes`
96+
// ref: https://github.com/aws/amazon-vpc-cni-k8s/issues/3524
97+
if b.Distribution == distributions.DistributionAmazonLinux2023 {
98+
contents := `
99+
[Match]
100+
Name=ens[6-9]* ens[1-9][0-9]*
101+
102+
[Link]
103+
Unmanaged=yes
104+
`
105+
106+
c.AddTask(&nodetasks.File{
107+
Path: "/etc/systemd/network/10-vpc-cni-secondary.network",
108+
Contents: fi.NewStringResource(contents),
109+
Type: nodetasks.FileType_File,
110+
OnChangeExecute: [][]string{{"systemctl", "restart", "systemd-networkd"}},
111+
})
112+
113+
}
114+
115+
// On Ubuntu 24.04+, cloud-init network hotplug is enabled by default
116+
// (https://github.com/canonical/cloud-init/pull/4799). This causes cloud-init to reconfigure netplan
117+
// when Amazon VPC CNI attaches ENIs, breaking network functionality.
118+
// See: https://github.com/kubernetes/kops/issues/17881
119+
if b.Distribution.IsUbuntu() && b.Distribution.Version() >= 24.04 {
120+
contents := `# Disable cloud-init network hotplug to prevent interference with Amazon VPC CNI ENI management.
121+
# See: https://github.com/kubernetes/kops/issues/17881
122+
updates:
123+
network:
124+
when: [boot-new-instance]
125+
`
126+
c.AddTask(&nodetasks.File{
127+
Path: "/etc/cloud/cloud.cfg.d/99-disable-network-hotplug.cfg",
128+
Contents: fi.NewStringResource(contents),
129+
Type: nodetasks.FileType_File,
130+
})
131+
}
132+
95133
return nil
96134
}

nodeup/pkg/model/networking/cilium.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ ManageForeignRoutingPolicyRules=no
7676
})
7777
}
7878

79+
if b.Distribution.IsUbuntu() && b.Distribution.Version() >= 24.04 {
80+
contents := `# Disable cloud-init network hotplug to prevent interference with Cilium ENI management.
81+
# See: https://github.com/kubernetes/kops/issues/17881
82+
updates:
83+
network:
84+
when: [boot-new-instance]
85+
`
86+
c.AddTask(&nodetasks.File{
87+
Path: "/etc/cloud/cloud.cfg.d/99-disable-network-hotplug.cfg",
88+
Contents: fi.NewStringResource(contents),
89+
Type: nodetasks.FileType_File,
90+
})
91+
}
92+
7993
return nil
8094
}
8195

0 commit comments

Comments
 (0)