no masters
This commit is contained in:
parent
421a49f6e8
commit
2fc2e53cc2
|
@ -1,6 +1,6 @@
|
||||||
# Setup up k8s cluster
|
# 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:
|
run:
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
cd host_vars
|
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
|
do
|
||||||
sed -i "s#^wg_secret_key.*#wg_secret_key: $(wg genkey)#" ${i}.yaml
|
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)
|
pubkey=$(cat ${i}.yaml | yq .wg_secret_key | sed 's/"//g' | wg pubkey)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[frontend]
|
[frontend]
|
||||||
cluster-frontend ansible_ssh_host=
|
cluster-frontend ansible_ssh_host=
|
||||||
|
|
||||||
[master]
|
[control]
|
||||||
cluster-master01 ansible_ssh_host=
|
cluster-control01 ansible_ssh_host=
|
||||||
#cluster-master02 ansible_ssh_host=
|
#cluster-control02 ansible_ssh_host=
|
||||||
#cluster-master03 ansible_ssh_host=
|
#cluster-control03 ansible_ssh_host=
|
||||||
|
|
||||||
[worker]
|
[worker]
|
||||||
cluster-worker01 ansible_ssh_host=
|
cluster-worker01 ansible_ssh_host=
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
name: docker
|
name: docker
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
- hosts: master
|
- hosts: control
|
||||||
tasks:
|
tasks:
|
||||||
- name: install haproxy
|
- name: install haproxy
|
||||||
apt:
|
apt:
|
||||||
|
@ -129,13 +129,13 @@
|
||||||
name: haproxy
|
name: haproxy
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
- hosts: cluster-master01
|
- hosts: cluster-control01
|
||||||
tasks:
|
tasks:
|
||||||
- name: init kubeadm
|
- name: init kubeadm
|
||||||
shell: kubeadm init --apiserver-advertise-address 10.42.23.11 --pod-network-cidr=10.244.0.0/16 > kubeadm.log
|
shell: kubeadm init --apiserver-advertise-address 10.42.23.11 --pod-network-cidr=10.244.0.0/16 > kubeadm.log
|
||||||
args:
|
args:
|
||||||
creates: kubeadm.log
|
creates: kubeadm.log
|
||||||
- name: fetch kubeadm.log from master
|
- name: fetch kubeadm.log from control
|
||||||
fetch:
|
fetch:
|
||||||
src: kubeadm.log
|
src: kubeadm.log
|
||||||
dest: kubeadm-{{ inventory_hostname }}.log
|
dest: kubeadm-{{ inventory_hostname }}.log
|
||||||
|
@ -152,7 +152,7 @@
|
||||||
- hosts: worker
|
- hosts: worker
|
||||||
tasks:
|
tasks:
|
||||||
- name: fetch join command
|
- name: fetch join command
|
||||||
command: tail -2 kubeadm-cluster-master01.log
|
command: tail -2 kubeadm-cluster-control01.log
|
||||||
register: joincommand
|
register: joincommand
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ PrivateKey = {{ wg_secret_key }}
|
||||||
ListenPort = 51820
|
ListenPort = 51820
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
Endpoint = {{ hostvars['cluster-master01'].ansible_ssh_host }}:51820
|
Endpoint = {{ hostvars['cluster-control01'].ansible_ssh_host }}:51820
|
||||||
PublicKey = {{ hostvars['cluster-master01'].wg_public_key }}
|
PublicKey = {{ hostvars['cluster-control01'].wg_public_key }}
|
||||||
AllowedIPs = {{ hostvars['cluster-master01'].wg_ip }}/32
|
AllowedIPs = {{ hostvars['cluster-control01'].wg_ip }}/32
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
Endpoint = {{ hostvars['cluster-worker01'].ansible_ssh_host }}:51820
|
Endpoint = {{ hostvars['cluster-worker01'].ansible_ssh_host }}:51820
|
||||||
|
|
Loading…
Reference in New Issue