Skip to content

Commit

Permalink
fix: enable IPv6 in Docker-based Talos clusters
Browse files Browse the repository at this point in the history
Docker by default disable IPv6 completely in the containers which breaks
SideroLink on Docker-based clusters, as SideroLink is using IPv6
addresses for the Wiregurard tunnel.

This change might break `talosctl cluster create` on host systems which
have IPv6 disabled completely, so provide a flag to revert this
behavior.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Apr 1, 2022
1 parent 3889a58 commit 19bf12a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/talosctl/cmd/mgmt/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ var (
configPatchWorker []string
badRTC bool
extraBootKernelArgs string
dockerDisableIPv6 bool
)

// createCmd represents the cluster up command.
Expand Down Expand Up @@ -250,6 +251,7 @@ func create(ctx context.Context) (err error) {

BundleURL: cniBundleURL,
},
DockerDisableIPv6: dockerDisableIPv6,
},

Image: nodeImage,
Expand Down Expand Up @@ -869,6 +871,7 @@ func init() {
createCmd.Flags().StringArrayVar(&configPatchWorker, "config-patch-worker", nil, "patch generated machineconfigs (applied to 'worker' type)")
createCmd.Flags().BoolVar(&badRTC, "bad-rtc", false, "launch VM with bad RTC state (QEMU only)")
createCmd.Flags().StringVar(&extraBootKernelArgs, "extra-boot-kernel-args", "", "add extra kernel args to the initial boot from vmlinuz and initramfs (QEMU only)")
createCmd.Flags().BoolVar(&dockerDisableIPv6, "docker-disable-ipv6", false, "skip enabling IPv6 in containers (Docker only)")

Cmd.AddCommand(createCmd)
}
10 changes: 10 additions & 0 deletions hack/release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ preface = """\
* Kubernetes: 1.24.0-beta.0
* Flannel: 0.17.0
* runc: 1.1.1
"""

[notes.dockeripv6]
title = "IPv6 in Docker-based Talos Clusters"
description="""\
The command `talosctl cluster create` now enables IPv6 by default for the Docker containers
created for Talos nodes. This allows to use IPv6 addresses in Kubernetes networking.
If `talosctl cluster create` fails to work on Linux due to the lack of IPv6 support,
please use the flag `--disable-docker-ipv6` to revert the change.
"""

[make_deps]
Expand Down
7 changes: 7 additions & 0 deletions pkg/provision/providers/docker/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ func (p *provisioner) createNode(ctx context.Context, clusterReq provision.Clust
},
}

if !clusterReq.Network.DockerDisableIPv6 {
// enable IPv6
hostConfig.Sysctls = map[string]string{
"net.ipv6.conf.all.disable_ipv6": "0",
}
}

// Ensure that the container is created in the talos network.

networkConfig := &network.NetworkingConfig{
Expand Down
3 changes: 3 additions & 0 deletions pkg/provision/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type NetworkRequest struct {

// CNI-specific parameters.
CNI CNIConfig

// Docker-specific parameters.
DockerDisableIPv6 bool
}

// NodeRequests is a list of NodeRequest.
Expand Down
1 change: 1 addition & 0 deletions website/content/v1.1/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ talosctl cluster create [flags]
--disk int default limit on disk size in MB (each VM) (default 6144)
--disk-image-path string disk image to use
--dns-domain string the dns domain to use for cluster (default "cluster.local")
--docker-disable-ipv6 skip enabling IPv6 in containers (Docker only)
--docker-host-ip string Host IP to forward exposed ports to (Docker provisioner only) (default "0.0.0.0")
--encrypt-ephemeral enable ephemeral partition encryption
--encrypt-state enable state partition encryption
Expand Down

0 comments on commit 19bf12a

Please sign in to comment.