Add Jinja2 template for Kubeadm configuration file. Add Ansible playbook to create a configuration file from the Jinja2 template. Add README.md with instructions and more information. Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org> |
||
|---|---|---|
| .. | ||
| kubeadm.conf.j2 | ||
| README.md | ||
| template.yml | ||
Using Ansible to Template a Kubeadm Configuration File
These files provide an example of how to use Ansible's template module to create a Kubeadm configuration file 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.
Contents
-
kubeadm.conf.j2: This Jinja2 template contains the framework for a Kubeadm configuration file.
-
README.md: The file you're currently reading.
-
template.yml: This Ansible playbook takes a series of variables along with the
kubeadm.conf.j2Jinja2 template and generates a Kubeadm configuration file.
Instructions
These instructions assume that you have Ansible installed and functioning correctly on your system.
-
Place the files from the
ansible/kubeadm-templatedirectory of this GitHub repository into a directory on your local system. You can clone the entire "learning-tools" repository (usinggit clone) or just download the specific files from theansible/kubeadm-templatefolder. -
(Optional) Edit
template.ymlto specify different values for the variables defined in the playbook. -
Run
ansible-playbook -i "localhost," -c local template.ymlto generate a Kubeadm configuration file from the template. The generated file will reside in the same directory askubeadm.conf.
Enjoy!
License
This content is licensed under the MIT License.