Kubernetes CoreOS Ignition Configuration Generator – Part 6

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Kubernetes CoreOS Ignition Configuration Generator Written in Python.

In the previous post I went through how to Configuring Kubernetes Træfik Ingress Controller, DNS, Dashboard. below are examples to use a small Python script I have written to automate most of the Kubernetes deployment process.

I divided the configuration into parts outlined below.

Note: An up-to-date example is available on my GitHub project page, or generate your own Kubernetes configuration with the Kubernetes generator available here on my GitHub page.

This is part 6 – Automate the Kubernetes deployment.

This document provides instructions on how to install and use the Python Kubernetes Generator Script. the script helps automate a Kubernetes deployment on CoreOS. See the deployment notes for additional details.

The code I am referencing is hosted on GitHub and can be accessed here.
The repository includes the Python Kubernetes generator script, as well as pre configured samples.

  1. The script helps automate a Kubernetes Multi-Master deployment on CoreOS.
  2. The script generates a CoreOS Ignition file that can be used, either as part of a 3 node Master cluster or just as a worker node.
  3. The generated Ignition file includes all required properties for, Etcd, Flannel(with CNI), Kubelet using (Rkt), etc.. all protocols are configured to use SSL.

The script uses a wizard-like approach with a minimum set of questions, just to be able to generate a configuration.

Getting Started

Installation

Dependencies / Prerequisites

The following libraries are required:
Note: The script will (try to) download and install the required libraries (if needed).

Note: You can also manually install the required libraries by running pip install [library]

Usage examples

To use the application just run the ./generate_template.py.

You can leave most of the default values by just hitting enter – (replace the IP Address, Hostnames, etc.. if you like..).

The default pre-set Hostname and IP Adress are below

CoreOS Cluster IP Address
 Name  IP Addrss
 coreos1  10.0.2.11/20
 coreos2  10.0.2.12/20
 coreos3  10.0.2.13/20

Tip: Re-run the script for every Master, worker, etc.. each run will generate a new configuration file that you can use.
Example

Details

The script generates the below list of files and Directories.

  1. ssl: Contains all SSL certificates used in the configuration including the CA certificate
  2. manifests: Contains all the manifests used to generate the Ignition
  3. keys: Contains the SSH Private and Public keys in the configuration
  4. configs: Contains the final configuration files, like. Ignition (mastr[n].ign), ISO with Ignition data on it(master[n].iso) and the YAML config(master[n].yaml).
  5. tmp: Contains all temporary configuration files.
  6. src: Contains the default Kubernetes properties, these files get updated at run time, based on your selections set as the default properties(for the next run).
  7. template: Contains all templates or ready sample templates used in the configuration.

Additional Usage Details

You can use the ign (or ISO with ign file) in a verity of ways.
If you are using bear-metal or virtual box, an example is explained below.

Boot from a CoreOS ISO/CD/USB which already contains the coreos-install script, or use any bootable CD, then download the CoreOS coreos-install script from here.

Next, use the generated Ignition file, you can use the IGN file, or use the ISO which contains the IGN file, the process is the same (like the below).

Now, run the coreos-install with the below parameters.
Note: the coreos-install script comes pre-installed on CoreOS.

Replace sda with your disk.
Use alpha or stable channel.

Once completed just reboot the server (or virtual) and you should be good to go.

To Do’s

  1. Convert SSL subprocess to pure Python code.
  2. Convert configuration files (in src directory) to a DB layer.
  3. Add include matchbox, PXE, DHCP, as an option for full automation.
  4. Add a Web-UI interface to manipulate properties.

You can download all necessary files from the GitHub project page available here..

You might also like – Other articles related to Docker Kubernetes / micro-service.

Like what you’re reading? please provide feedback, any feedback is appreciated.

Leave a Reply

avatar
  Subscribe  
Notify of