Skip to content

Commit ee214bb

Browse files
authored
Solve an issue where serviceaccount is not created (#238)
There is an issue that the flannel-overlay.yml does not create the ServiceAccount flannel and needed to be manually created. Also updated the readiness of the guide, there was an issue with a part of the code which identation was not okay
1 parent 0f4ad8c commit ee214bb

File tree

2 files changed

+55
-121
lines changed

2 files changed

+55
-121
lines changed
Lines changed: 13 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,62 @@
11

22
# Adding Windows nodes
33

4-
5-
64
You can use Kubernetes to run a mixture of Linux and Windows nodes, so you can mix Pods that run on Linux on with Pods that run on Windows. This is a guide on how to register Windows nodes to your cluster.
75

8-
96

107
## Before you begin
118

12-
13-
149
Your Kubernetes server must be at or later than version 1.22. To check the version, enter `kubectl version`.
1510

16-
17-
1811
- Obtain a [Windows Server 2019 license](https://www.microsoft.com/en-us/cloud-platform/windows-server-pricing) (or higher) in order to configure the Windows node that hosts Windows containers. If you are using VXLAN/Overlay networking you must have also have [KB4489899](https://support.microsoft.com/help/4489899) installed.
1912

2013
- A Linux-based Kubernetes kubeadm cluster in which you have access to the control plane (see [Creating a single control-plane cluster with kubeadm](https://kubernetes-docsy-staging.netlify.app/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/)).
2114

22-
2315

2416
## Objectives
2517

26-
27-
2818
- Register a Windows node to the cluster
29-
3019
- Configure networking so Pods and Services on Linux and Windows can communicate with each other
3120

32-
3321

3422
## Getting Started: Adding a Windows Node to Your Cluster
3523

36-
3724

3825
### Networking Configuration
3926

40-
41-
4227
Once you have a Linux-based Kubernetes control-plane node you are ready to choose a networking solution.
4328

44-
4529

4630
#### Configuring Flannel with rancher
4731

48-
49-
5032
1. Prepare Kubernetes control plane for Flannel
5133

5234
Some minor preparation is recommended on the Kubernetes control plane in our cluster. It is recommended to enable bridged IPv4 traffic to iptables chains when using Flannel. The following command must be run on all Linux nodes:
5335

5436
```bash
55-
5637
sudo sysctl net.bridge.bridge-nf-call-iptables=1
57-
5838
```
5939

6040
2. Download & configure Flannel for Linux
6141

6242
Download the most recent Flannel manifest:
6343

6444
```bash
65-
6645
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
67-
6846
```
6947

7048
Modify the `net-conf.json` section of the flannel manifest in order to set the VNI to 4096 and the Port to 4789. It should look as follows:
7149

7250
```json
73-
7451
net-conf.json: |
75-
76-
{
77-
78-
"Network": "10.244.0.0/16",
79-
80-
"Backend": {
81-
82-
"Type": "vxlan",
83-
84-
"VNI" : 4096,
85-
86-
"Port": 4789
87-
88-
}
89-
90-
}
91-
52+
{
53+
"Network": "10.244.0.0/16",
54+
"Backend": {
55+
"Type": "vxlan",
56+
"VNI" : 4096,
57+
"Port": 4789
58+
}
59+
}
9260
```
9361

9462
> **Note:** The VNI must be set to 4096 and port 4789 for Flannel on Linux to interoperate with Flannel on Windows. See the [VXLAN documentation](https://github.com/coreos/flannel/blob/master/Documentation/backends.md#vxlan). for an explanation of these fields.
@@ -100,83 +68,60 @@ net-conf.json: |
10068
Let's apply the Flannel configuration:
10169

10270
```bash
103-
10471
kubectl apply -f kube-flannel.yml
105-
10672
```
10773

10874
After a few minutes, you should see all the pods as running if the Flannel pod network was deployed.
10975

11076
```bash
111-
112-
kubectl get pods -n kube-system
113-
77+
kubectl get pods -n kube-flannel
11478
```
11579

11680
The output should include the Linux flannel DaemonSet as running:
11781

11882
```
119-
12083
NAMESPACE NAME READY STATUS RESTARTS AGE
121-
12284
...
123-
12485
kube-system kube-flannel-ds-54954 1/1 Running 0 1m
125-
12686
```
12787

12888
4. Add Windows Flannel and kube-proxy DaemonSets
12989

130-
131-
13290
Now you can add Windows-compatible versions of Flannel and kube-proxy. In order to ensure that you get a compatible version of kube-proxy, you'll need to substitute the tag of the image. The following example shows usage for Kubernetes v1.24.3, but you should adjust the version for your own deployment.
13391

134-
135-
13692
```bash
137-
13893
curl -L https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/kube-proxy.yml | sed 's/VERSION/v1.24.3/g' | kubectl apply -f -
139-
14094
kubectl apply -f https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/flannel-overlay.yml
141-
14295
```
14396

14497
> **Note** If you are using another version of kubernetes on your windows node, change v1.24.3 with your own version .
145-
14698
> To find your version of kubernetes run the following command:
99+
> `kubeadm version`
147100
148-
> `kubeadm version`
149101
5. Apply kube-flannel-rbac.yml from sig-windows-tools/kubeadm/flannel
150102
Next you will need to apply the configuration that allows flannel to spawn pods and keep them running:
151-
```bash
103+
104+
```bash
152105
git clone https://github.com/kubernetes-sigs/sig-windows-tools
153106
kubectl apply -f sig-windows-tools/kubeadm/flannel/kube-flannel-rbac.yml
154107
```
155108

156-
### Joining a Windows worker node
157109

158-
110+
### Joining a Windows worker node
159111

160112
> **Note:** All code snippets in Windows sections are to be run in a PowerShell environment with elevated permissions (Administrator) on the Windows worker node.
161113
162-
163-
164114
1. Install ContainerD, wins, kubelet, and kubeadm.
165115

166116
```PowerShell
167-
168117
git clone https://github.com/kubernetes-sigs/sig-windows-tools
169-
170118
cd .\sig-windows-tools\kubeadm\scripts\
171119
172120
# Install ContainerD
173-
174121
.\Install-Containerd.ps1
175122
176123
# Install wins, kubelet and kubeadm
177-
178124
.\PrepareNode.ps1 -KubernetesVersion v1.24.3 -ContainerRuntime containerD
179-
180125
```
181126

182127
> **Note** If you want to install another version of kubernetes, modify v1.24.3 with the version you want to install
@@ -190,40 +135,23 @@ Use the command that was given to you when you ran `kubeadm init` on a control p
190135

191136
> **Note:** Do not forget to add `--cri-socket "npipe:////./pipe/containerd-containerd" --v=5` at the end of the join command, if you use ContainerD
192137
193-
194-
195138
3. Install kubectl for windows (optional)
196139

197140
For more information about it : https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
198141

199-
200142

201143
#### Verifying your installation
202144

203-
204-
205145
You should now be able to view the Windows node in your cluster by running:
206146

207-
208-
209147
```bash
210-
211148
kubectl get nodes -o wide
212-
213149
```
214150

215-
216-
217151
If your new node is in the `NotReady` state it is likely because the flannel image is still downloading. You can check the progress as before by checking on the flannel pods in the `kube-system` namespace:
218152

219-
220-
221153
```shell
222-
223154
kubectl -n kube-system get pods -l app=flannel
224-
225155
```
226156

227-
228-
229157
Once the flannel Pod is running, your node should enter the `Ready` state and then be available to handle workloads.
Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: flannel
6+
namespace: kube-system
7+
---
28
kind: ClusterRole
39
apiVersion: rbac.authorization.k8s.io/v1
410
metadata:
@@ -36,40 +42,40 @@ subjects:
3642
- kind: ServiceAccount
3743
name: flannel
3844
namespace: kube-system
39-
---
40-
kind: ConfigMap
41-
apiVersion: v1
42-
metadata:
43-
name: kube-flannel-cfg
44-
namespace: kube-system
45-
labels:
46-
tier: node
47-
app: flannel
48-
data:
49-
cni-conf.json: |
50-
{
51-
"name": "cbr0",
52-
"plugins": [
53-
{
54-
"type": "flannel",
55-
"delegate": {
56-
"hairpinMode": true,
57-
"isDefaultGateway": true
58-
}
59-
},
60-
{
61-
"type": "portmap",
62-
"capabilities": {
63-
"portMappings": true
64-
}
65-
}
66-
]
67-
}
68-
net-conf.json: |
69-
{
70-
"Network": "10.244.0.0/16",
71-
"Backend": {
72-
"Type": "vxlan"
73-
}
74-
}
45+
---
46+
kind: ConfigMap
47+
apiVersion: v1
48+
metadata:
49+
name: kube-flannel-cfg
50+
namespace: kube-system
51+
labels:
52+
tier: node
53+
app: flannel
54+
data:
55+
cni-conf.json: |
56+
{
57+
"name": "cbr0",
58+
"plugins": [
59+
{
60+
"type": "flannel",
61+
"delegate": {
62+
"hairpinMode": true,
63+
"isDefaultGateway": true
64+
}
65+
},
66+
{
67+
"type": "portmap",
68+
"capabilities": {
69+
"portMappings": true
70+
}
71+
}
72+
]
73+
}
74+
net-conf.json: |
75+
{
76+
"Network": "10.244.0.0/16",
77+
"Backend": {
78+
"Type": "vxlan"
79+
}
80+
}
7581
---

0 commit comments

Comments
 (0)