Update documentation

Update README.md with instructions on using these files

Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
This commit is contained in:
Scott Lowe 2018-07-16 16:28:00 -06:00
parent 04648e46b5
commit a0551b84ce
No known key found for this signature in database
GPG key ID: 949F43F6E6C11780

View file

@ -2,25 +2,33 @@
These files provide an example of how to use Ansible's `template` module to create a Kubeadm 1.11 configuration file (with local etcd support) from a Jinja2 template. The template and Ansible playbook were tested using Ansible 2.5 on Fedora 27, but should work on any recent version of Ansible on any supported platform.
**NOTE:** At this time, the `kubeadm.conf` generated by this playbook has _not_ been verified to create a working, conformant Kubernetes cluster. It is for demonstration purposes only.
**NOTE:** At this time, the `kubeadm` configuration files generated by this playbook have _not_ been verified to create a working, conformant Kubernetes cluster. Consider them to be for demonstration purposes only.
## Contents
* **kubeadm.conf.j2**: This Jinja2 template contains the framework for a Kubeadm configuration file.
* **1-kubeadm.conf.j2**: This Jinja2 template contains the framework for a Kubeadm configuration file. This template is for the first stacked master.
* **2-kubeadm.conf.j2**: This Jinja2 template contains the framework for a Kubeadm configuration file. This template is for the second stacked master.
* **3-kubeadm.conf.j2**: This Jinja2 template contains the framework for a Kubeadm configuration file. This template is for the third stacked master.
* **ansible.cfg**: This is an Ansible configuration file. You may need to edit this file based on the target systems you're using with this environment.
* **README.md**: The file you're currently reading.
* **template.yml**: This Ansible playbook takes a series of variables along with the `kubeadm.conf.j2` Jinja2 template and generates a Kubeadm configuration file.
* **template.yml**: This Ansible playbook takes a series of variables along with the `*-kubeadm.conf.j2` Jinja2 templates. The output is three different `kubeadm` configuration files.
## Instructions
These instructions assume that you have Ansible installed and functioning correctly on your system.
1. Place the files from the `ansible/kubeadm-template` directory of this GitHub repository into a directory on your local system. You can clone the entire "learning-tools" repository (using `git clone`) or just download the specific files from the `ansible/kubeadm-template` folder.
1. Place the files from the `ansible/kubeadm-etcd-template` directory of this GitHub repository into a directory on your local system. You can clone the entire "learning-tools" repository (using `git clone`) or just download the specific files from the `ansible/kubeadm-etcd-template` folder.
2. (Optional) Edit `template.yml` to specify different values for the variables defined in the playbook.
3. Run `ansible-playbook -i "localhost," -c local template.yml` to generate a Kubeadm configuration file from the template. The generated file will reside in the same directory as `kubeadm.conf`.
3. This environment was tested using a CentOS-based AMI running on AWS, and as such uses the EC2 dynamic inventory module. Edit `inventory/ec2.ini` and `inventory/hosts` as needed to ensure that this environment will work for your specific inventory. You may also need to edit `ansible.cfg`, depending on the Linux distribution you choose to use.
4. Run `ansible-playbook template.yml` to generate the three different `kubeadm` configuration files. They will be rendered in the same directory as `kubeadm-cfg-first.yaml`, `kubeadm-cfg-second.yaml`, and `kubeadm-cfg-third.yaml`, respectively.
Enjoy!