Skip to content

Commit

Permalink
add dual stack node ips for join configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
pacoxu committed Mar 2, 2021
1 parent 068c493 commit 3af2f4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion content/en/docs/concepts/services-networking/dual-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,5 @@ Ensure your {{< glossary_tooltip text="CNI" term_id="cni" >}} provider supports
## {{% heading "whatsnext" %}}


* [Dual-stack enabled](/docs/concepts/services-networking/dual-stack/) cluster
* [Validate IPv4/IPv6 dual-stack](/docs/tasks/network/validate-dual-stack) networking
* [Dual-stack support with kubeadm](/docs/setup/production-environment/tools/kubeadm/dual-stack-support/)
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
---
reviewers:
- sig-cluster-lifecycle
- neolit123
- sftim
title: Enable Or Disable Dual-Stack via kubeadm
title: Dual-stack support with kubeadm
feature:
title: Enable Or Disable Dual-Stack via kubeadm
title: Dual-stack support with kubeadm
content_type: task
weight: 110
---
Expand All @@ -25,18 +21,18 @@ Install kubeadm following the steps from the [Installing Kubeadm](/docs/setup/pr
Make sure that nodes allow IPv6 forwarding, if not, run `sudo sysctl -w net.ipv6.conf.all.forwarding=1` on every node in the cluster.

{{< note >}}
`kubeadm upgrade` will change `IPv6DualStack` to true by default if feature gate is not set in old cluster. However, cluster-cidr and service-cidr modification are not supported.
`kubeadm upgrade` will change `IPv6DualStack` to true by default if the feature gate is not set in an old cluster. However, cluster CIDR and service CIDR modifications are not supported.
{{< /note >}}

### Create a dual-stack cluster

A simple command with `podCidr` and `serviceCidr` flags to create a dual-stack cluster via `kubeadm init`, it like below:
To create a dual-stack cluster with `kubeadm init` you can pass the following flags:

```shell
kubeadm init --feature-gates IPv6DualStack=true --pod-network-cidr=10.244.0.0/16,fd00:10:244::/56 --service-cidr=10.96.0.0/16,fd00:10:96::/112
kubeadm init --pod-network-cidr=10.244.0.0/16,fd00:10:244::/56 --service-cidr=10.96.0.0/16,fd00:10:96::/112
```

To make things more clear, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for the dual-stack control plane node.
To make things clearer, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for the primary dual-stack control plane node.

```yaml
apiVersion: kubeadm.k8s.io/v1beta2
Expand All @@ -58,23 +54,24 @@ nodeRegistration:
node-ip: 10.100.0.2,fd00:1:2:3::2
```
`advertiseAddress` in InitConfiguration specifies the IP address the API Server will advertise it's listening on. It equals to `--apiserver-advertise-address` flag of `kubeadm init`.
`advertiseAddress` in InitConfiguration specifies the IP address the API Server will advertise it's listening on. It equals to the `--apiserver-advertise-address` flag of `kubeadm init`.

Run kubeadm to initiate the dual-stack control plane node.

```shell
kubeadm init --config=kubeadm-config.yaml
```

Currently, `kube-controller-manager` flags `--node-cidr-mask-size-ipv4|--node-cidr-mask-size-ipv6` are setting with the default value. See [enable IPv4/IPv6 dual stack](/docs/concepts/services-networking/dual-stack#enable-ipv4ipv6-dual-stack).
Currently, the kube-controller-manager flags `--node-cidr-mask-size-ipv4|--node-cidr-mask-size-ipv6` are being left with default values. See [enable IPv4/IPv6 dual stack](/docs/concepts/services-networking/dual-stack#enable-ipv4ipv6-dual-stack).

There is a limitation here, `--apiserver-advertise-address` flag doesn't support dual-stack.
{{< note >}}
Currently the `--apiserver-advertise-address` flag does not support dual-stack.
{{< /note >}}

### Join a node to dual-stack cluster

Before joining a node, make sure that the node has IPv6 routable network interface and allows IPv6 forwarding.


Here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for joining a worker node to the cluster.

```yaml
Expand All @@ -85,9 +82,13 @@ discovery:
apiServerEndpoint: 10.100.0.1:6443
token: 0c0z4p.dnafh6vnmouus569
caCertHashes: ["sha256:fcb3e956a6880c05fc9d09714424b827f57a6fdc8afc44497180905946527adf"]
nodeRegistration:
kubeletExtraArgs:
fail-swap-on: "false"
node-ip: 10.100.0.3,fd00:1:2:3::3
```

Besides, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for joining another control plane node to the cluster.
Also, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for joining another control plane node to the cluster.
```yaml
apiVersion: kubeadm.k8s.io/v1beta2
kind: JoinConfiguration
Expand All @@ -100,9 +101,14 @@ discovery:
apiServerEndpoint: 10.100.0.1:6443
token: 0c0z4p.dnafh6vnmouus569
caCertHashes: ["sha256:fcb3e956a6880c05fc9d09714424b827f57a6fdc8afc44497180905946527adf"]
nodeRegistration:
kubeletExtraArgs:
fail-swap-on: "false"
node-ip: 10.100.0.4,fd00:1:2:3::4
```

`advertiseAddress` in JoinConfiguration.controlPlane specifies the IP address the API Server will advertise it's listening on. It equals to `--apiserver-advertise-address` flag of `kubeadm join`.
`advertiseAddress` in JoinConfiguration.controlPlane specifies the IP address the API Server will advertise it's listening on. It equals to the `--apiserver-advertise-address` flag of `kubeadm join`.

```shell
kubeadm join --config=kubeadm-config.yaml ...
Expand Down Expand Up @@ -134,5 +140,5 @@ networking:

## {{% heading "whatsnext" %}}


* [Validate IPv4/IPv6 dual-stack](/docs/tasks/network/validate-dual-stack) networking
* [Dual-stack enabled](/docs/concepts/services-networking/dual-stack/) cluster

0 comments on commit 3af2f4e

Please sign in to comment.