|
| 1 | +# Adding Windows Worker nodes to an openCenter Kubernetes cluster |
| 2 | + |
| 3 | +## Requirements |
| 4 | +* A working openCenter cluster with at least 1 linux worker node. |
| 5 | +* Windows servers added to the oc_windows_workers group in the ansible inventory. Must be accessible via `SSH`. Yes SSH. |
| 6 | +* |
| 7 | + |
| 8 | + |
| 9 | +The main.tf file will require additional local variables and variables passed to the openTofu modules. |
| 10 | + |
| 11 | +| Option | Default | Type | Description | |
| 12 | +| :------- | :------: | :-------: | -------: | |
| 13 | +| image_id_windows | "" | string | Glance image ID for Windows Server | |
| 14 | +| flavor_worker_windows | "" | string | Openstack Flavor name | |
| 15 | +| windows_user | "Administrator" | string | Admin user for Windows Server | |
| 16 | +| windows_admin_password | "" | String | Password for Admin user of Windows Server| |
| 17 | +| worker_node_bfv_size_windows | 0 | number | Volume Size of root disk for Windows Server | |
| 18 | +| worker_node_bfv_type_windows | "local" | string | Volume type. Can be either "local" or "volume" | |
| 19 | + |
| 20 | + |
| 21 | +The Openstack Nova module needs to get the values passed |
| 22 | + |
| 23 | +``` |
| 24 | +
|
| 25 | +source = "github.com/rackerlabs/openCenter-gitops-base.git//iac/cloud/openstack/openstack-nova?ref=main" { |
| 26 | + ... |
| 27 | + size_worker_windows = { |
| 28 | + count = local.worker_count_windows |
| 29 | + flavor = local.flavor_worker_windows |
| 30 | + } |
| 31 | + windows_admin_password = local.windows_admin_password |
| 32 | + windows_user = local.windows_user |
| 33 | + worker_node_bfv_type_windows = local.worker_node_bfv_type_windows |
| 34 | + worker_node_bfv_size_windows = local.worker_node_bfv_size_windows |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +There is an ansible collection in `github.com/rackerlabs/opencenter-windows.git` that can be used to configure the windows nodes as workers and have them join the cluster. |
| 39 | + |
| 40 | +Set the collections path to the local cluster inventory file. |
| 41 | + |
| 42 | +```bash |
| 43 | + |
| 44 | +source venv/bin/activate |
| 45 | +export ANSIBLE_COLLECTIONS_PATHS=${PWD}/inventory/ |
| 46 | +export ANSIBLE_INVENTORY=${PWD}/inventory/inventory.yaml |
| 47 | + |
| 48 | + ``` |
| 49 | + |
| 50 | +requirements.yml |
| 51 | + |
| 52 | +```yaml |
| 53 | +--- |
| 54 | +collections: |
| 55 | + - name: https://github.com/rackerlabs/opencenter-windows.git |
| 56 | + type: git |
| 57 | + version: main |
| 58 | +``` |
| 59 | +
|
| 60 | +Install the collection |
| 61 | +
|
| 62 | +```bash |
| 63 | +ansible-galaxy collection install -r requirements.yml |
| 64 | +``` |
| 65 | + |
| 66 | +windows-worker.yaml |
| 67 | + |
| 68 | +```yaml |
| 69 | +- name: Join Windows to Kubernetes cluster |
| 70 | + hosts: oc_windows_nodes |
| 71 | + gather_facts: yes |
| 72 | + collections: |
| 73 | + - rackerlabs.opencenter_windows_workers |
| 74 | + tasks: |
| 75 | + - name: Gather variables for each operating system |
| 76 | + ansible.builtin.import_role: |
| 77 | + name: kubespray/roles/kubespray_defaults |
| 78 | + |
| 79 | + - name: Setup win-containerd |
| 80 | + ansible.builtin.include_role: |
| 81 | + name: win-containerd |
| 82 | + |
| 83 | + - name: Setup win-kubeadm |
| 84 | + ansible.builtin.include_role: |
| 85 | + name: win-kubeadm |
| 86 | +``` |
| 87 | +
|
| 88 | +`ansible-playbook windows-workers.yaml` |
| 89 | + |
| 90 | +## Post Join steps |
| 91 | +Taint the nodes to avoid confusing the scheduler |
| 92 | +`kubectl taint node mig-dev-win0 node.kubernetes.io/os=windows:NoSchedule` |
| 93 | + |
| 94 | + |
| 95 | +Once Calico has been deployed via the Tigera Operator the IPAM Config must get patched. |
| 96 | + |
| 97 | +`kubectl patch ipamconfigurations default --type merge --patch='{"spec": {"strictAffinity": true}}'` |
| 98 | + |
0 commit comments