Skip to content

Commit 485b738

Browse files
authored
Merge pull request #17945 from kubernetes/peter.rifel/iproute2
Create iproute2 symlink for kuberouter on older distros
2 parents c92a592 + e4b2451 commit 485b738

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

nodeup/pkg/model/networking/kube_router.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"k8s.io/kops/pkg/rbac"
2222
"k8s.io/kops/upup/pkg/fi"
2323
"k8s.io/kops/upup/pkg/fi/nodeup/nodetasks"
24+
"k8s.io/kops/util/pkg/distributions"
2425
)
2526

2627
// KuberouterBuilder installs kube-router
@@ -56,5 +57,23 @@ func (b *KuberouterBuilder) Build(c *fi.NodeupModelBuilderContext) error {
5657
BeforeServices: []string{"kubelet.service"},
5758
})
5859

60+
// On older Debian/Ubuntu versions, iproute2 config lives in /etc/iproute2/ rather than /usr/share/iproute2/.
61+
// Create a symlink so the kube-router DaemonSet can mount /usr/share/iproute2/rt_tables.
62+
// Ref: https://github.com/kubernetes/kops/issues/17914
63+
switch b.Distribution {
64+
case distributions.DistributionDebian11,
65+
distributions.DistributionDebian12,
66+
distributions.DistributionUbuntu2204,
67+
distributions.DistributionUbuntu2404:
68+
c.AddTask(&nodetasks.File{
69+
Path: "/usr/share/iproute2",
70+
Type: nodetasks.FileType_Symlink,
71+
Symlink: fi.PtrTo("/etc/iproute2"),
72+
Owner: fi.PtrTo("root"),
73+
Group: fi.PtrTo("root"),
74+
Mode: fi.PtrTo("0755"),
75+
})
76+
}
77+
5978
return nil
6079
}

upup/models/cloudup/resources/addons/networking.kuberouter/k8s-1.12.yaml.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ spec:
110110
mountPath: /run/xtables.lock
111111
readOnly: false
112112
- name: rt-tables
113-
mountPath: /etc/iproute2/rt_tables
113+
mountPath: /usr/share/iproute2/rt_tables
114114
readOnly: false
115115
- name: containerd-sock
116116
mountPath: /run/containerd/containerd.sock
@@ -158,7 +158,7 @@ spec:
158158
type: FileOrCreate
159159
- name: rt-tables
160160
hostPath:
161-
path: /etc/iproute2/rt_tables
161+
path: /usr/share/iproute2/rt_tables
162162
type: FileOrCreate
163163
- name: containerd-sock
164164
hostPath:

0 commit comments

Comments
 (0)