While I'm learning Kubernetes, I decided to create a couple of ansible playbooks that install a kubernetes cluster, a network plugin, and it's still open for further modifications.

The scripts and further documentation can be can be downloaded from Github (https://github.com/dszortyka/k8s-cluster-node-deploy). They are basically the same commands from this post.

Playbooks

deploy_all.yaml — Used to deploy all the commands at once. Cluster, network plugin, node and kubernetes dashboard (to be created).

— Used to deploy all the commands at once. Cluster, network plugin, node and kubernetes dashboard (to be created). deploy_customer.yaml — Used to init the kubernetes cluster.

— Used to init the kubernetes cluster. deploy_network.yaml — Install the network plugin (default=calico) once the cluster is installed and running. The script can be adjusted for Flannel network, make sure to review the kubeadm init parameters.

— Install the network plugin (default=calico) once the cluster is installed and running. The script can be adjusted for Flannel network, make sure to review the kubeadm init parameters. deploy_node.yaml — Finally, this script join the node into the k8 cluster.

— Finally, this script join the node into the k8 cluster. cicd_inventory.yaml — Contains a regular ansible inventory file with the hosts to be used in the installation. Defaults are "cluster" and "nodes".

— Contains a regular ansible inventory file with the hosts to be used in the installation. Defaults are "cluster" and "nodes". base.yaml — Contain base packages like docker, kube* apps, OS configuration for both cluster and nodes. It also contains the following parameters to be adjusted before running the any of the scripts.

— set_fact: apiserver_advertise_address=”10.0.0.98"

— set_fact: pod_network_cidr=”192.168.0.0/16"

These scripts were all tested in virtual machines using Virtualbox and CentOS 7.

Screenshots

deploy_cluster — playbook execution

deploy_cluster — kubeadm init