Replace everything in <>
brackets with your own strings. These all run on the Ansible executor.
cd
into the Kubespray repo / foldercp -rfp inventory/sample inventory/<CLUSTER_NAME>
Create inventory/<CLUSTER_NAME>/hosts.yaml
with the contents:
all:
children:
calico-rr:
hosts: {}
etcd:
hosts:
node1:
kube-master:
hosts:
node1:
kube-node:
hosts:
node1:
k8s-cluster:
children:
kube-master:
kube-node:
vars:
slate_cluster_name: <SLATE_CLUSTER_NAME>
slate_group_name: <SLATE_CLUSTER_GROUP>
slate_org_name: <SLATE_CLUSTER_ORG>
hosts:
node1:
# The IP to use for SSH connections to this host.
ansible_host: <HOST_IP>
# The IP to use for binding Kubernetes services.
ip: <HOST_IP>
You can add additional nodes under hosts:
and add them to kube-master
and/or kube-node
similar to how it is done with node1
. Node names can be anything (i.e. instead of node1
, it can be the FQDN of the host). However, due to Kubernetes restrictions, all characters in the node name must be lowercase.
These are the default configuration steps we provide. Please read Additional Configurations to see if any of those apply to you before continuing.
Configure MetalLB by changing these lines in inventory/<CLUSTER_NAME>/group_vars/k8s-cluster/addons.yml
from
...
# MetalLB deployment
metallb_enabled: false
# metallb_ip_range:
# - "10.5.0.50-10.5.0.99"
# metallb_version: v0.9.3
...
to
metallb_enabled: true
metallb_ip_range:
- "<YOUR_IP>/<YOUR_SUBNET>"
metallb_version: v0.9.3
You can alternatively set metallb_ip_range
like so:
metallb_ip_range:
- "<YOUR_IP>/32" # Single IP
- "<YOUR_IP_START>-<YOUR_IP_END>" # Range of IPs
The IP addresses listed here must be the unassigned public IPs mentioned in the prerequisites.
Configure strict ARP by changing these lines in inventory/<CLUSTER_NAME>/group_vars/k8s-cluster/k8s-cluster.yml
from
kube_proxy_strict_arp: false
to
kube_proxy_strict_arp: true # Required for MetalLB
Run the kubespray playbook:
ansible-playbook -i inventory/<CLUSTER_NAME>/hosts.yaml --become --become-user=root -u <SSH_USER> cluster.yml
cd
into the slate-ansible repo or folder.
Run the SLATE registration playbook:
ansible-playbook -i /path/to/kubespray/inventory/<CLUSTER_NAME>/hosts.yaml -u <SSH_USER> --become --become-user=root \
-e 'slate_cli_token=<SLATE_CLI_TOKEN>' \
-e 'slate_cli_endpoint=https://api.slateci.io:443' \
site.yml