-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support stacked control plane nodes for HA cluster
- Loading branch information
Showing
9 changed files
with
249 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
- name: Default cri-o flags to empty | ||
set_fact: | ||
arg_crio: "" | ||
|
||
- name: Set cri-o flags | ||
set_fact: | ||
arg_crio: "--ignore-preflight-errors=all" | ||
when: container_runtime == "crio" | ||
|
||
- name: Default cri-o flags to empty | ||
set_fact: | ||
kubeadm_master_cert: "" | ||
|
||
- name: set master config in kubeadm option | ||
set_fact: | ||
kubeadm_master_cert: "--control-plane --certificate-key {{ kubeadm_cert_key }}" | ||
|
||
- name: Join each node to the master with the join command | ||
shell: > | ||
{{ kubeadm_join_command }} {{ kubeadm_master_cert }} | ||
args: | ||
creates: /etc/.kubeadm-joined | ||
|
||
- name: Mark the nodes as joined | ||
file: | ||
path: /etc/.kubeadm-joined | ||
state: directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- name: "Disable SELinux :(" | ||
selinux: | ||
state: disabled | ||
|
||
- name: Install haproxy | ||
package: | ||
name: haproxy | ||
state: present | ||
|
||
- name: backup original | ||
copy: | ||
src: /etc/haproxy/haproxy.cfg | ||
dest: /etc/haproxy/haproxy.cfg.orig | ||
|
||
- name: create haproxy.cfg | ||
template: | ||
src: haproxy.cfg.j2 | ||
dest: /etc/haproxy/haproxy.cfg | ||
|
||
- name: start haproxy | ||
systemd: | ||
name: haproxy.service | ||
state: started | ||
enabled: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#--------------------------------------------------------------------- | ||
# Example configuration for a possible web application. See the | ||
# full configuration options online. | ||
# | ||
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt | ||
# | ||
#--------------------------------------------------------------------- | ||
|
||
#--------------------------------------------------------------------- | ||
# Global settings | ||
#--------------------------------------------------------------------- | ||
global | ||
# to have these messages end up in /var/log/haproxy.log you will | ||
# need to: | ||
# | ||
# 1) configure syslog to accept network log events. This is done | ||
# by adding the '-r' option to the SYSLOGD_OPTIONS in | ||
# /etc/sysconfig/syslog | ||
# | ||
# 2) configure local2 events to go to the /var/log/haproxy.log | ||
# file. A line like the following can be added to | ||
# /etc/sysconfig/syslog | ||
# | ||
# local2.* /var/log/haproxy.log | ||
# | ||
log 127.0.0.1 local2 | ||
|
||
chroot /var/lib/haproxy | ||
pidfile /var/run/haproxy.pid | ||
maxconn 4000 | ||
user haproxy | ||
group haproxy | ||
daemon | ||
|
||
# turn on stats unix socket | ||
stats socket /var/lib/haproxy/stats | ||
|
||
#--------------------------------------------------------------------- | ||
# common defaults that all the 'listen' and 'backend' sections will | ||
# use if not designated in their block | ||
#--------------------------------------------------------------------- | ||
defaults | ||
mode http | ||
log global | ||
option httplog | ||
option dontlognull | ||
option http-server-close | ||
option forwardfor except 127.0.0.0/8 | ||
option redispatch | ||
retries 3 | ||
timeout http-request 10s | ||
timeout queue 1m | ||
timeout connect 10s | ||
timeout client 1m | ||
timeout server 1m | ||
timeout http-keep-alive 10s | ||
timeout check 10s | ||
maxconn 3000 | ||
|
||
#--------------------------------------------------------------------- | ||
# main frontend which proxys to the backends | ||
#--------------------------------------------------------------------- | ||
frontend kubernetes | ||
bind {{ ansible_default_ipv4.address }}:6443 | ||
option tcplog | ||
mode tcp | ||
default_backend kubernetes-master-nodes | ||
#--------------------------------------------------------------------- | ||
# static backend for serving up images, stylesheets and such | ||
#--------------------------------------------------------------------- | ||
backend static | ||
balance roundrobin | ||
server static 127.0.0.1:4331 check | ||
#--------------------------------------------------------------------- | ||
# round robin balancing between the various backends | ||
#--------------------------------------------------------------------- | ||
backend kubernetes-master-nodes | ||
mode tcp | ||
balance roundrobin | ||
option tcp-check | ||
{% for node in groups["master"] %} | ||
server {{ node }} {{ hostvars[node]['ansible_host'] }}:6443 check | ||
{% endfor %} | ||
{% for node in groups["master_slave"] %} | ||
server {{ node }} {{ hostvars[node]['ansible_host'] }}:6443 check | ||
{% endfor %} |