no masters

This commit is contained in:
chris 2019-05-30 13:37:13 +02:00
parent 421a49f6e8
commit 2fc2e53cc2
8 changed files with 13 additions and 13 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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=

View file

@ -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

View file

@ -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