Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/media/kuber_configs/check_apiserveer.sh.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

errorExit() {
echo "*** $@" 1>&2
exit 1
}

curl --silent --max-time 2 --insecure https://localhost:6443/ -o /dev/null || errorExit "Error GET https://localhost:6443/"
if ip addr | grep -q {{ virtual_ip }}; then
curl --silent --max-time 2 --insecure https://{{ virtual_ip }}:6443/ -o /dev/null || errorExit "Error GET https://{{ virtual_ip }}:6443/"
fi
28 changes: 28 additions & 0 deletions app/media/kuber_configs/haproxy.cfg.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# HAProxy Statistics Report Page
frontend stats-frontend
bind *:8080
mode http
stats enable
stats hide-version
stats uri /stats
stats realm Haproxy\ Statistics
stats auth admin:{{ haproxy_frontend_password }} # Change 'admin:password' to your desired strong username and password

# No backend is required for exporting stats in HAProxy.


frontend kubernetes-frontend
bind *:6443
mode tcp
option tcplog
default_backend kubernetes-backend

backend kubernetes-backend
option httpchk GET /healthz
http-check expect status 200
mode tcp
option ssl-hello-chk
balance roundrobin
{% for host in groups['k8s_masters'] %}
server {{ host }} {{ hostvars[host]['private_ip'] }}:6443 check fall 3 rise 2
{% endfor %}
26 changes: 26 additions & 0 deletions app/media/kuber_configs/keepalived.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
vrrp_script check_apiserver {
script "/etc/keepalived/check_apiserver.sh"
interval 3 # check api server every 3 seconds
timeout 10 # timeout second if api server doesn't answered
fall 5 # failed time
rise 2 # success 2 times
weight -2 # if failed is done it reduce 2 of the weight
}

vrrp_instance VI_1 {
state BACKUP
interface {{ interface_name }} # set your interface
virtual_router_id 1
priority 100
advert_int 5
authentication {
auth_type PASS
auth_pass mysecret
}
virtual_ipaddress {
{{ virtual_ip }}
}
track_script {
check_apiserver
}
}
12 changes: 12 additions & 0 deletions app/media/kuber_configs/kubeadmcnf-join.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: JoinConfiguration
nodeRegistration:
criSocket: {{ cri_socket }}

---
kind: ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
kubernetesVersion: "{{ k8s_version }}"


13 changes: 13 additions & 0 deletions app/media/kuber_configs/kubeadmcnf.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: InitConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
nodeRegistration:
criSocket: {{ cri_socket }}
imagePullPolicy: IfNotPresent
---
kind: ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
kubernetesVersion: "{{ k8s_version }}"
controlPlaneEndpoint: "{{ apiserver_url }}"
certificatesDir: /etc/kubernetes/pki
networking:
podSubnet: {{ pod_network_cidr }}
20 changes: 20 additions & 0 deletions app/media/kuber_configs/resolv.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# {{ ansible_managed }}

{% if resolv_search is defined and resolv_search | length > 0 %}
search {{ resolv_search|join(' ') }}
{% endif %}
{% if resolv_domain is defined and resolv_domain != "" %}
domain {{ resolv_domain }}
{% endif %}
{% for ns in resolv_nameservers %}
nameserver {{ ns }}
{% endfor %}
{% if resolv_sortlist is defined and resolv_sortlist | length > 0 %}
{% for sl in resolv_sortlist %}
sortlist {{ sl }}
{% endfor %}
{% endif %}
{% if resolv_options is defined and resolv_options | length > 0 %}
options {{ resolv_options|join(' ') }}
{% endif %}