Skip to content

Commit

Permalink
[Windows] Set Node IP after kubeadm join complete (#743)
Browse files Browse the repository at this point in the history
In the document we have a step to set the Node IP used by
kubelet by editing the kubeadm-flags.env file. However, the
file only exists after "kubeadm join" completes.

This patch moves the set Node IP step after "kubeadm join".
And adds a "restart-service kubelet" operation to make the configuration
change effective.

Signed-off-by: Rui Cao <rcao@vmware.com>
  • Loading branch information
ruicao93 committed May 28, 2020
1 parent 2b59005 commit 11beb34
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions docs/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Download `kube-proxy.yaml` from kubernetes official repository and set
kube-proxy version.
```
# Example:
curl.exe -LO https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/kube-proxy.yml | sed 's/VERSION/v1.18.0/g' > kube-proxy.yaml
curl -L https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/kube-proxy.yml | sed 's/VERSION/v1.18.0/g' > kube-proxy.yml
```
Replace the content of `run-script.ps1` in configmap named `kube-proxy-windows`
as following:
Expand Down Expand Up @@ -112,9 +112,9 @@ spec:
spec:
hostNetwork: true
```
Then apply the `kube-proxy.yaml`.
Then apply the `kube-proxy.yml`.
```
kubectl apply -f kube-proxy.yaml
kubectl apply -f kube-proxy.yml
```

#### Join Windows worker Nodes
Expand Down Expand Up @@ -160,16 +160,6 @@ container.
curl.exe -LO https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/PrepareNode.ps1
.\PrepareNode.ps1 -KubernetesVersion v1.18.0
```
Then, set the Node IP used by kubelet.
Open file `/var/lib/kubelet/kubeadm-flags.env`:
```
KUBELET_KUBEADM_ARGS="--cgroup-driver= --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.1"
```
Append "--node-ip=$NODE_IP" arg at the end of params. Replace `$NODE_IP` with
the address for kubelet. It should look like:
```
KUBELET_KUBEADM_ARGS="--cgroup-driver= --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.1 --node-ip=$NODE_IP"```
```

4. Prepare network adapter for kubernetes service

Expand Down Expand Up @@ -197,6 +187,21 @@ generate a new token and join command.
kubeadm join 192.168.101.5:6443 --token tdp0jt.rshv3uobkuoobb4v --discovery-token-ca-cert-hash sha256:84a163e57bf470f18565e44eaa2a657bed4da9748b441e9643ac856a274a30b9
```

Then, set the Node IP used by kubelet.
Open file `/var/lib/kubelet/kubeadm-flags.env`:
```
KUBELET_KUBEADM_ARGS="--cgroup-driver= --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.1"
```
Append `--node-ip=$NODE_IP` at the end of params. Replace `$NODE_IP` with
the address for kubelet. It should look like:
```
KUBELET_KUBEADM_ARGS="--cgroup-driver= --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.1 --node-ip=$NODE_IP"```
```
Restart kubelet service for changes to take effect.
```
restart-service kubelet
```

#### Verify your installation
There will be temporary network interruption on Windows worker Node on the
first startup of antrea-agent. It's because antrea-agent will set the OVS to
Expand Down

0 comments on commit 11beb34

Please sign in to comment.