diff --git a/setup/README.md b/setup/README.md index 71fe354..d3f0221 100644 --- a/setup/README.md +++ b/setup/README.md @@ -1,6 +1,6 @@ # Setup up k8s cluster -currently only supports single master, stacked etcd cluster with three to six worker nodes. +currently only supports single controller, stacked etcd cluster with three to six worker nodes. run: diff --git a/setup/generate-keys.sh b/setup/generate-keys.sh index 24e0210..e8b8eb6 100755 --- a/setup/generate-keys.sh +++ b/setup/generate-keys.sh @@ -1,5 +1,5 @@ cd host_vars -for i in cluster-frontend cluster-master01 cluster-master02 cluster-master03 cluster-worker01 cluster-worker02 cluster-worker03 cluster-worker04 cluster-worker05 cluster-worker06 +for i in cluster-frontend cluster-control01 cluster-control02 cluster-control03 cluster-worker01 cluster-worker02 cluster-worker03 cluster-worker04 cluster-worker05 cluster-worker06 do sed -i "s#^wg_secret_key.*#wg_secret_key: $(wg genkey)#" ${i}.yaml pubkey=$(cat ${i}.yaml | yq .wg_secret_key | sed 's/"//g' | wg pubkey) diff --git a/setup/host_vars/cluster-master01.yaml b/setup/host_vars/cluster-control01.yaml similarity index 100% rename from setup/host_vars/cluster-master01.yaml rename to setup/host_vars/cluster-control01.yaml diff --git a/setup/host_vars/cluster-master02.yaml b/setup/host_vars/cluster-control02.yaml similarity index 100% rename from setup/host_vars/cluster-master02.yaml rename to setup/host_vars/cluster-control02.yaml diff --git a/setup/host_vars/cluster-master03.yaml b/setup/host_vars/cluster-control03.yaml similarity index 100% rename from setup/host_vars/cluster-master03.yaml rename to setup/host_vars/cluster-control03.yaml diff --git a/setup/inventory.yaml b/setup/inventory.yaml index 1dfc80d..f1e0970 100644 --- a/setup/inventory.yaml +++ b/setup/inventory.yaml @@ -1,10 +1,10 @@ [frontend] cluster-frontend ansible_ssh_host= -[master] -cluster-master01 ansible_ssh_host= -#cluster-master02 ansible_ssh_host= -#cluster-master03 ansible_ssh_host= +[control] +cluster-control01 ansible_ssh_host= +#cluster-control02 ansible_ssh_host= +#cluster-control03 ansible_ssh_host= [worker] cluster-worker01 ansible_ssh_host= diff --git a/setup/setup.yml b/setup/setup.yml index 09b0401..8e36190 100644 --- a/setup/setup.yml +++ b/setup/setup.yml @@ -106,7 +106,7 @@ name: docker state: restarted -- hosts: master +- hosts: control tasks: - name: install haproxy apt: @@ -129,13 +129,13 @@ name: haproxy state: restarted -- hosts: cluster-master01 +- hosts: cluster-control01 tasks: - name: init kubeadm shell: kubeadm init --apiserver-advertise-address 10.42.23.11 --pod-network-cidr=10.244.0.0/16 > kubeadm.log args: creates: kubeadm.log - - name: fetch kubeadm.log from master + - name: fetch kubeadm.log from control fetch: src: kubeadm.log dest: kubeadm-{{ inventory_hostname }}.log @@ -152,7 +152,7 @@ - hosts: worker tasks: - name: fetch join command - command: tail -2 kubeadm-cluster-master01.log + command: tail -2 kubeadm-cluster-control01.log register: joincommand delegate_to: localhost diff --git a/setup/templates/wg-k8s.conf b/setup/templates/wg-k8s.conf index dc1f556..107ddcd 100644 --- a/setup/templates/wg-k8s.conf +++ b/setup/templates/wg-k8s.conf @@ -3,9 +3,9 @@ PrivateKey = {{ wg_secret_key }} ListenPort = 51820 [Peer] -Endpoint = {{ hostvars['cluster-master01'].ansible_ssh_host }}:51820 -PublicKey = {{ hostvars['cluster-master01'].wg_public_key }} -AllowedIPs = {{ hostvars['cluster-master01'].wg_ip }}/32 +Endpoint = {{ hostvars['cluster-control01'].ansible_ssh_host }}:51820 +PublicKey = {{ hostvars['cluster-control01'].wg_public_key }} +AllowedIPs = {{ hostvars['cluster-control01'].wg_ip }}/32 [Peer] Endpoint = {{ hostvars['cluster-worker01'].ansible_ssh_host }}:51820