File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ errorExit () {
4+ echo " *** $@ " 1>&2
5+ exit 1
6+ }
7+
8+ curl --silent --max-time 2 --insecure https://localhost:6443/ -o /dev/null || errorExit " Error GET https://localhost:6443/"
9+ if ip addr | grep -q {{ virtual_ip }}; then
10+ curl --silent --max-time 2 --insecure https://{{ virtual_ip }}:6443/ -o /dev/null || errorExit " Error GET https://{{ virtual_ip }}:6443/"
11+ fi
Original file line number Diff line number Diff line change 1+ # HAProxy Statistics Report Page
2+ frontend stats-frontend
3+ bind *:8080
4+ mode http
5+ stats enable
6+ stats hide-version
7+ stats uri /stats
8+ stats realm Haproxy\ Statistics
9+ stats auth admin:{{ haproxy_frontend_password }} # Change 'admin:password' to your desired strong username and password
10+
11+ # No backend is required for exporting stats in HAProxy.
12+
13+
14+ frontend kubernetes-frontend
15+ bind *:6443
16+ mode tcp
17+ option tcplog
18+ default_backend kubernetes-backend
19+
20+ backend kubernetes-backend
21+ option httpchk GET /healthz
22+ http-check expect status 200
23+ mode tcp
24+ option ssl-hello-chk
25+ balance roundrobin
26+ {% for host in groups ['k8s_masters' ] %}
27+ server {{ host }} {{ hostvars[host] ['private_ip'] }}:6443 check fall 3 rise 2
28+ {% endfor %}
Original file line number Diff line number Diff line change 1+ vrrp_script check_apiserver {
2+ script "/etc/keepalived/check_apiserver.sh"
3+ interval 3 # check api server every 3 seconds
4+ timeout 10 # timeout second if api server doesn't answered
5+ fall 5 # failed time
6+ rise 2 # success 2 times
7+ weight -2 # if failed is done it reduce 2 of the weight
8+ }
9+
10+ vrrp_instance VI_1 {
11+ state BACKUP
12+ interface {{ interface_name }} # set your interface
13+ virtual_router_id 1
14+ priority 100
15+ advert_int 5
16+ authentication {
17+ auth_type PASS
18+ auth_pass mysecret
19+ }
20+ virtual_ipaddress {
21+ {{ virtual_ip }}
22+ }
23+ track_script {
24+ check_apiserver
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion: kubeadm.k8s.io/v1beta3
3+ kind: JoinConfiguration
4+ nodeRegistration:
5+ criSocket: {{ cri_socket }}
6+
7+ ---
8+ kind: ClusterConfiguration
9+ apiVersion: kubeadm.k8s.io/v1beta3
10+ kubernetesVersion: "{{ k8s_version }}"
11+
12+
Original file line number Diff line number Diff line change 1+ kind: InitConfiguration
2+ apiVersion: kubeadm.k8s.io/v1beta3
3+ nodeRegistration:
4+ criSocket: {{ cri_socket }}
5+ imagePullPolicy: IfNotPresent
6+ ---
7+ kind: ClusterConfiguration
8+ apiVersion: kubeadm.k8s.io/v1beta3
9+ kubernetesVersion: "{{ k8s_version }}"
10+ controlPlaneEndpoint: "{{ apiserver_url }}"
11+ certificatesDir: /etc/kubernetes/pki
12+ networking:
13+ podSubnet: {{ pod_network_cidr }}
Original file line number Diff line number Diff line change 1+
2+ # {{ ansible_managed }}
3+
4+ {% if resolv_search is defined and resolv_search | length > 0 %}
5+ search {{ resolv_search|join(' ') }}
6+ {% endif %}
7+ {% if resolv_domain is defined and resolv_domain != "" %}
8+ domain {{ resolv_domain }}
9+ {% endif %}
10+ {% for ns in resolv_nameservers %}
11+ nameserver {{ ns }}
12+ {% endfor %}
13+ {% if resolv_sortlist is defined and resolv_sortlist | length > 0 %}
14+ {% for sl in resolv_sortlist %}
15+ sortlist {{ sl }}
16+ {% endfor %}
17+ {% endif %}
18+ {% if resolv_options is defined and resolv_options | length > 0 %}
19+ options {{ resolv_options|join(' ') }}
20+ {% endif %}
You can’t perform that action at this time.
0 commit comments