The ansible playbooks are able to deploy a kubernetes cluster with Windows minion nodes and Flannel as SDN solution. It supports docker or containerd as a container runtime.
The recommended version is 2.7.2
.
For Linux: Make sure that you are able to SSH into the target nodes without being asked for the password. You can read more here.
For Windows: Follow this guide to setup the node to be used with ansible.
Populate your hosts inventory file with the hostnames and IPs of your machines.
[kube-master]
test-master
[kube-minions-windows]
test-min0
test-min1
Update Linux machies username in group_vars in the kube-master and kube-minions ( if any ) vars files.
ansible_ssh_user: ubuntu
Update Windows machines settings in group_vars ( kube-minions-windows).
ansible_port: 5986 // winrm port
ansible_connection: winrm // type or ansible connection for remoting
ansible_user:
ansible_password:
CONTAINER_RUNTIME: docker | containerd
containerd_url: url to zip containerd binaries
Set the flannel mode in inventory/group_vars/all:
FLANNEL_MODE: "overlay" | "host-gw"
Set the CNI binaries in inventory/group_vars/all:
CNIBINS: "cniwin" | "sdnms"
NOTE:
cniwin - refers to the win-bridge and win-overlay cni plugins maintainerd in github.com/containernetworking/plugins sdnms - refers to the sdnbridge and sdnoverlay cni plugins maintained by Microsoft in github.com/Microsoft/windows-container-networking
To verify the setup and that ansible has been successfully configured you can run the following:
ansible --key-file=ssh_private_key_path -m setup all
This will connect to the target hosts and will gather host facts. If the command succeeds and everything is green, you're good to go with running the playbook.
Make sure to update first the inventory with details about the nodes.
To start the playbook, please run the following:
ansible-playbook -i inventory/hosts kubernetes-cluster.yml --private-key=ssh_private_key_path
-
All binaries used by the playbooks will be downloaded from locations specified in the vars. If you want to use your custom builds ( recommended ) you should have them present on the ansible machine in the ansible tmp folder (ansible_root/tmp). Ansible will take care of copying them to the k8s master / k8s minion nodes.
-
Containerd only supports the sdnms CNI bins option.
Currently supported Linux nodes:
- 16.04
Currently supported Windows nodes:
- Windows Server 2019 LTSC and build version 1809 (OS Version 10.0.17763.0)
The following ports need to be opened if we access the cluster machines via the public address.
- Kubernetes service ports (deployment specific): UDP and TCP
30000 - 32767
- Kubelet (default port): TCP
10250
- Kubernetes API: TCP
8080
for HTTP and TCP443
for HTTPS
- WinRM via HTTPS: TCP
5986
(for HTTP also TCP5985
) - SSH: TCP
22
- Windows RDP Port: 3389 (TCP)
- ICMP: useful for debugging