|
6 | 6 |
|
7 | 7 | Ansible playbooks for deploying AlviStack.
|
8 | 8 |
|
| 9 | +AlviStack-Ansible provides Ansible playbooks and roles for the deployment and configuration of an [Kubernetes](https://github.com/kubernetes/kubernetes) environment. |
| 10 | + |
9 | 11 | ## Requirements
|
10 | 12 |
|
11 |
| -This playbook require Ansible 2.8 or higher. |
| 13 | +This playbook require Ansible 2.9 or higher. |
| 14 | + |
| 15 | +This playbook was designed for Ubuntu 16.04/18.04 or RHEL/CentOS 7 or openSUSE Leap 15.1. |
| 16 | + |
| 17 | +## Quick Start |
| 18 | + |
| 19 | +### Bootstrap Ansible and Roles |
| 20 | + |
| 21 | +Start by cloning the Alvistack-Ansible repository, checkout the corresponding branch, and init with `git submodule`, then bootstrap Python3 + Ansible with provided helper script: |
| 22 | + |
| 23 | + # GIT clone the development branch |
| 24 | + git clone --branch develop https://github.com/alvistack/alvistack-ansible |
| 25 | + cd alvistack-ansible |
| 26 | + |
| 27 | + # Setup Roles with GIT submodule |
| 28 | + git submodule init |
| 29 | + git submodule sync |
| 30 | + git submodule update |
| 31 | + |
| 32 | + # Bootstrap Ansible |
| 33 | + ./scripts/bootstrap-ansible.sh |
| 34 | + |
| 35 | + # Confirm the version of Python3, PIP3 and Ansible |
| 36 | + python3 --version |
| 37 | + pip3 --version |
| 38 | + ansible --version |
| 39 | + |
| 40 | +### AIO |
| 41 | + |
| 42 | +All-in-one (AIO) build is a great way to perform an Kubernetes build for: |
| 43 | + |
| 44 | + - A development environment |
| 45 | + - An overview of how all the Kubernetes services fit together |
| 46 | + - A simple lab deployment |
| 47 | + |
| 48 | +This deployment will setup the follow components: |
| 49 | + |
| 50 | + - [Flannel](https://github.com/coreos/flannel) |
| 51 | + - [Dashboard](https://github.com/kubernetes/dashboard) |
| 52 | + - [NGINX Ingress Controller](https://github.com/kubernetes/ingress-nginx) |
| 53 | + - [cert-manager](https://github.com/jetstack/cert-manager) |
| 54 | + - [Local Path Provisioner](https://github.com/rancher/local-path-provisioner) |
| 55 | + |
| 56 | +Simply run the playbooks with sample AIO inventory: |
| 57 | + |
| 58 | + # Run playbooks |
| 59 | + ansible-playbook -i inventory/aio/hosts playbooks/setup-aio.yml |
| 60 | + |
| 61 | + # Confirm the version and status of Kubernetes |
| 62 | + kubectl version |
| 63 | + kubectl get node |
| 64 | + kubectl get pod --all-namespaces |
| 65 | + |
| 66 | +### Production |
| 67 | + |
| 68 | +For production environment we should backed with [Ceph File System](https://docs.ceph.com/docs/master/cephfs/) for [Kubernetes Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). |
| 69 | + |
| 70 | +Moreover, using [Weave Net](https://github.com/weaveworks/weave) as network plugin so we could support [Kubernetes Network Policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/). |
| 71 | + |
| 72 | +Finally, in order to avoid [Single Point of Failure](https://en.wikipedia.org/wiki/Single_point_of_failure), at least 3 instances for CephFS and 3 instances for Kubernetes is recommended. |
| 73 | + |
| 74 | +This deployment will setup the follow components: |
| 75 | + |
| 76 | + - [Ceph](https://ceph.io/) |
| 77 | + - [Weave Net](https://github.com/weaveworks/weave) |
| 78 | + - [Dashboard](https://github.com/kubernetes/dashboard) |
| 79 | + - [NGINX Ingress Controller](https://github.com/kubernetes/ingress-nginx) |
| 80 | + - [cert-manager](https://github.com/jetstack/cert-manager) |
| 81 | + - [CephFS Volume Provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/ceph/cephfs) |
| 82 | + |
| 83 | +Start by copying the sample inventory for customization: |
| 84 | + |
| 85 | + # Copy sample inventory |
| 86 | + cp -rfp inventory/sample inventory/myinventory |
| 87 | + |
| 88 | +Once update `inventory/myinventory/hosts` as per your production environment, now run the playbooks: |
| 89 | + |
| 90 | + # Run playbooks |
| 91 | + ansible-playbook -i inventory/myinventory/hosts playbooks/setup-everything.yml |
| 92 | + ansible-playbook -i inventory/myinventory/hosts playbooks/setup-ansible.yml |
| 93 | + |
| 94 | + # Confirm the version and status of Ceph |
| 95 | + ceph --version |
| 96 | + ceph --status |
| 97 | + ceph health detail |
| 98 | + |
| 99 | + # Confirm the version and status of Kubernetes |
| 100 | + kubectl version |
| 101 | + kubectl get node |
| 102 | + kubectl get pod --all-namespaces |
| 103 | + |
| 104 | +Moreover, we don't setup the Ceph OSD and Ceph MDS for you, which you should set it up once manually according to your production environment, e.g.: |
| 105 | + |
| 106 | + # Initialize individual OSDs |
| 107 | + ceph-volume lvm create --bluestore --data /dev/sdb |
| 108 | + ceph-volume lvm create --bluestore --data /dev/sdc |
| 109 | + ceph-volume lvm create --bluestore --data /dev/sdd |
| 110 | + ceph-volume lvm activate --all |
| 111 | + |
| 112 | + # Create OSD pool for RBD |
| 113 | + ceph osd pool create rbd 8 8 |
| 114 | + ceph osd pool set rbd size 3 |
| 115 | + ceph osd pool set rbd min_size 2 |
| 116 | + |
| 117 | + # Create OSD pool for CephFS Metadata |
| 118 | + ceph osd pool create cephfs_metadata 32 32 |
| 119 | + ceph osd pool set cephfs_metadata size 3 |
| 120 | + ceph osd pool set cephfs_metadata min_size 2 |
| 121 | + |
| 122 | + # Create OSD pool for CephFS data |
| 123 | + ceph osd pool create cephfs_data 128 128 |
| 124 | + ceph osd pool set cephfs_data size 3 |
| 125 | + ceph osd pool set cephfs_data min_size 2 |
| 126 | + |
| 127 | + # Create CephFS |
| 128 | + ceph fs new cephfs cephfs_metadata cephfs_data |
| 129 | + ceph fs set cephfs standby_count_wanted 0 |
| 130 | + ceph fs set cephfs max_mds 1 |
| 131 | + |
| 132 | +### Molecule |
| 133 | + |
| 134 | +You could also run our [Molecule](https://molecule.readthedocs.io/en/stable/) test cases if you have [LXD](https://lxd.readthedocs.io/en/latest/) or [Vagrant](https://www.vagrantup.com/) installed, e.g. |
| 135 | + |
| 136 | + # Run Molecule on Ubuntu 18.04 with LXD |
| 137 | + molecule converge -s ubuntu-18.04 |
| 138 | + |
| 139 | + # Run Molecule on Ubuntu 18.04 with Vagrant |
| 140 | + molecule converge -s ubuntu-18.04-vagrant |
12 | 141 |
|
13 |
| -This playbook was designed for Ubuntu 16.04/18.04 or RHEL/CentOS 7 or openSUSE Leap 15.0. |
| 142 | +Please refer to [.travis.yml](.travis.yml) for more information on running Molecule and LXD. |
14 | 143 |
|
15 | 144 | ## License
|
16 | 145 |
|
|
0 commit comments