1、download ansible roles and put into roles of kargo folder.
https://github.com/devops-coop/ansible-haproxy
https://github.com/tcomerma/ansible-keepalived
2、add hosts in inventory
[ext-lb]
test-51
test-67
[lb-kld]
test-51
test-67
3、uncommit external LB configure
External LB example config
apiserver_loadbalancer_domain_name: "elb.k8s.com"
loadbalancer_apiserver:
address: 192.168.181.200
port: 8383
4、add some sections in cluster.yml
-
hosts: ext-lb
any_errors_fatal: true
roles:
- role: haproxy
haproxy_frontends:
- name: 'fe-kube-apiserver'
ip: '192.168.181.200'
port: '8383'
maxconn: '1000'
default_backend: 'be-kube-apiserver'
haproxy_backends:
- name: 'be-kube-apiserver'
description: 'kube-apiserver is really cool'
servers:
- name: 'be-kube-apiserver-01'
ip: '192.168.181.51:6443'
- name: 'be-kube-apiserver-02'
ip: '192.168.181.67:6443'
-
hosts: lb-kld[0]
any_errors_fatal: true
roles:
- { role: keepalived, keepalived_shared_ip: "192.168.181.200", keepalived_role: "master" }
-
hosts: lb-kld[1]:!k8s-cluster
any_errors_fatal: true
roles:
- { role: keepalived, keepalived_shared_ip: "192.168.181.200", keepalived_role: "slave" }
5 run kargo with ansible
ulimit -n 50000
cd ../kargo
nohup ansible-playbook -i inventory/hosts cluster.yml -vvv --flush-cache
NOTE: CERT ISSUES,
https://github.com/kubernetes/kubernetes/pull/14889/files?w=1