Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions docs/adding-windows-nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Adding Windows Worker nodes to an openCenter Kubernetes cluster

## Requirements
* A working openCenter cluster with at least 1 linux worker node.
* Windows servers added to the oc_windows_workers group in the ansible inventory. Must be accessible via `SSH`. Yes SSH.
*


The main.tf file will require additional local variables and variables passed to the openTofu modules.

| Option | Default | Type | Description |
| :------- | :------: | :-------: | -------: |
| image_id_windows | "" | string | Glance image ID for Windows Server |
| flavor_worker_windows | "" | string | Openstack Flavor name |
| windows_user | "Administrator" | string | Admin user for Windows Server |
| windows_admin_password | "" | String | Password for Admin user of Windows Server|
| worker_node_bfv_size_windows | 0 | number | Volume Size of root disk for Windows Server |
| worker_node_bfv_type_windows | "local" | string | Volume type. Can be either "local" or "volume" |


The Openstack Nova module needs to get the values passed

```

source = "github.com/rackerlabs/openCenter-gitops-base.git//iac/cloud/openstack/openstack-nova?ref=main" {
...
size_worker_windows = {
count = local.worker_count_windows
flavor = local.flavor_worker_windows
}
windows_admin_password = local.windows_admin_password
windows_user = local.windows_user
worker_node_bfv_type_windows = local.worker_node_bfv_type_windows
worker_node_bfv_size_windows = local.worker_node_bfv_size_windows
}
```

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.

Set the collections path to the local cluster inventory file.

```bash

source venv/bin/activate
export ANSIBLE_COLLECTIONS_PATHS=${PWD}/inventory/
export ANSIBLE_INVENTORY=${PWD}/inventory/inventory.yaml

```

requirements.yml

```yaml
---
collections:
- name: https://github.com/rackerlabs/opencenter-windows.git
type: git
version: main
```

Install the collection

```bash
ansible-galaxy collection install -r requirements.yml
```

windows-worker.yaml

```yaml
- name: Join Windows to Kubernetes cluster
hosts: oc_windows_nodes
gather_facts: yes
collections:
- rackerlabs.opencenter_windows_workers
tasks:
- name: Gather variables for each operating system
ansible.builtin.import_role:
name: kubespray/roles/kubespray_defaults

- name: Setup win-containerd
ansible.builtin.include_role:
name: win-containerd

- name: Setup win-kubeadm
ansible.builtin.include_role:
name: win-kubeadm
```

`ansible-playbook windows-workers.yaml`

## Post Join steps
Taint the nodes to avoid confusing the scheduler
`kubectl taint node mig-dev-win0 node.kubernetes.io/os=windows:NoSchedule`


Once Calico has been deployed via the Tigera Operator the IPAM Config must get patched.

`kubectl patch ipamconfigurations default --type merge --patch='{"spec": {"strictAffinity": true}}'`

4 changes: 2 additions & 2 deletions iac/cloud/openstack/lib/openstack-compute-windows/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "openstack_networking_port_v2" "node" {
name = "${var.naming_prefix}${var.node_type}${count.index}"
name = "${substr(var.naming_prefix, 0, 8)}${var.node_type}${count.index}"
count = var.node_count
network_id = var.network_id

Expand All @@ -18,7 +18,7 @@ resource "openstack_networking_port_v2" "node" {
}

resource "openstack_compute_instance_v2" "node" {
name = "${var.naming_prefix}${var.node_type}${count.index}"
name = "${substr(var.naming_prefix, 0, 8)}${var.node_type}${count.index}"
config_drive = true # Windows needs config drive
count = var.node_count
flavor_name = var.flavor_name
Expand Down
Loading