Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support kube-proxy nftables mode #3577

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/apis/config/v1alpha4/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ type Networking struct {
// If DisableDefaultCNI is true, kind will not install the default CNI setup.
// Instead the user should install their own CNI after creating the cluster.
DisableDefaultCNI bool `yaml:"disableDefaultCNI,omitempty" json:"disableDefaultCNI,omitempty"`
// KubeProxyMode defines if kube-proxy should operate in iptables or ipvs mode
// KubeProxyMode defines if kube-proxy should operate in iptables, ipvs or nftables mode
// Defaults to 'iptables' mode
KubeProxyMode ProxyMode `yaml:"kubeProxyMode,omitempty" json:"kubeProxyMode,omitempty"`
// DNSSearch defines the DNS search domain to use for nodes. If not set, this will be inherited from the host.
Expand All @@ -213,6 +213,8 @@ const (
IPTablesProxyMode ProxyMode = "iptables"
// IPVSProxyMode sets ProxyMode to ipvs
IPVSProxyMode ProxyMode = "ipvs"
// NFTablesProxyMode sets ProxyMode to nftables
NFTablesProxyMode ProxyMode = "nftables"
)

// PatchJSON6902 represents an inline kustomize json 6902 patch
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/internal/kubeadm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type ConfigData struct {
// The Token for TLS bootstrap
Token string

// KubeProxyMode defines the kube-proxy mode between iptables or ipvs
// KubeProxyMode defines the kube-proxy mode between iptables, ipvs or nftables
KubeProxyMode string
// The subnet used for pods
PodSubnet string
Expand Down
4 changes: 3 additions & 1 deletion pkg/internal/apis/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ type Networking struct {
// If DisableDefaultCNI is true, kind will not install the default CNI setup.
// Instead the user should install their own CNI after creating the cluster.
DisableDefaultCNI bool
// KubeProxyMode defines if kube-proxy should operate in iptables or ipvs mode
// KubeProxyMode defines if kube-proxy should operate in iptables, ipvs or nftables mode
KubeProxyMode ProxyMode
// DNSSearch defines the DNS search domain to use for nodes. If not set, this will be inherited from the host.
DNSSearch *[]string
Expand All @@ -174,6 +174,8 @@ const (
IPTablesProxyMode ProxyMode = "iptables"
// IPVSProxyMode sets ProxyMode to ipvs
IPVSProxyMode ProxyMode = "ipvs"
// NFTablesProxyMode sets ProxyMode to nftables
NFTablesProxyMode ProxyMode = "nftables"
// NoneProxyMode disables kube-proxy
NoneProxyMode ProxyMode = "none"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/apis/config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *Cluster) Validate() error {

// KubeProxyMode should be iptables or ipvs
if c.Networking.KubeProxyMode != IPTablesProxyMode && c.Networking.KubeProxyMode != IPVSProxyMode &&
c.Networking.KubeProxyMode != NoneProxyMode {
c.Networking.KubeProxyMode != NoneProxyMode && c.Networking.KubeProxyMode != NFTablesProxyMode {
errs = append(errs, errors.Errorf("invalid kubeProxyMode: %s", c.Networking.KubeProxyMode))
}

Expand Down
6 changes: 3 additions & 3 deletions site/content/docs/user/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ networking:

#### kube-proxy mode

You can configure the kube-proxy mode that will be used, between iptables and ipvs. By
default iptables is used
You can configure the kube-proxy mode that will be used, between iptables, nftables (Kubernetes v1.31+), and ipvs.
By default iptables is used

{{< codeFromInline lang="yaml" >}}
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
kubeProxyMode: "ipvs"
kubeProxyMode: "nftables"
{{< /codeFromInline >}}

To disable kube-proxy, set the mode to `"none"`.
Expand Down
Loading