Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 1 | #!/bin/bash -xe |
| 2 | exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1 |
| 3 | |
| 4 | # Create and distribute SSL certificates for services using salt state |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 5 | salt '*' state.sls salt |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 6 | |
| 7 | # Install keepalived |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 8 | salt -C 'I@keepalived:cluster' state.sls keepalived -b 1 |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 9 | |
| 10 | # Install haproxy |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 11 | salt -C 'I@haproxy:proxy' state.sls haproxy |
| 12 | salt -C 'I@haproxy:proxy' service.status haproxy |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 13 | |
| 14 | # Install docker |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 15 | salt -C 'I@docker:host' state.sls docker.host |
| 16 | salt -C 'I@docker:host' cmd.run "docker ps" |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 17 | |
| 18 | # Install etcd |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 19 | salt -C 'I@etcd:server' state.sls etcd.server.service |
| 20 | salt -C 'I@etcd:server' cmd.run ". /var/lib/etcd/configenv && etcdctl cluster-health" |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 21 | |
| 22 | # Install Kubernetes and Calico |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 23 | salt -C 'I@kubernetes:master' state.sls kubernetes.master.kube-addons |
| 24 | salt -C 'I@kubernetes:pool' state.sls kubernetes.pool |
| 25 | salt -C 'I@kubernetes:pool' cmd.run "calicoctl node status" |
| 26 | salt -C 'I@kubernetes:pool' cmd.run "calicoctl get ippool" |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 27 | |
| 28 | # Setup NAT for Calico |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 29 | salt -C 'I@kubernetes:master' --subset 1 state.sls etcd.server.setup |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 30 | |
| 31 | # Run whole master to check consistency |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 32 | salt -C 'I@kubernetes:master' state.sls kubernetes exclude=kubernetes.master.setup |
Tomáš Kukrál | bd9af06 | 2017-05-02 23:16:44 +0200 | [diff] [blame] | 33 | |
| 34 | # Register addons |
Tomáš Kukrál | 509e06e | 2017-05-10 19:51:26 +0200 | [diff] [blame] | 35 | salt -C 'I@kubernetes:master' --subset 1 state.sls kubernetes.master.setup |