This repo intent to follow steps described on Kelsey Hightower kubernetes the hard way tutorial, but using ansible.
- Ansible
- GCP account
- GCP project to build infrastructure
To avoid conflicts with old python versions or any other issue with python packages, the use of virtual python environment management is recommended, mini conda is a good option to try (installation/configuration is out of the scope of this tutorial)
Update variables on host_vars/localhost.yaml
with the values needed
aut_kind
: only serviceaccount
type is supported
controllers
: how many controllers will be built (default
: 1)
ip_cdr_range
The network range to create for the cluster nodes
lb_ip_name
: Name of the load balancer ip, it will be associated to the cluster latter on
network_name
: Name of the network resource
prefix
: last octet prefix, 1 for controllers 2 for workers (no need to update this)
project
: Project to build the infrastructure (reads from environment variable)
region
: Region to run the infrastructure
scopes
: Default scopes for GCP objects
serviceaccount
: Where the service account json file is, full path (reads from environment variable)
subnetwork_name
: The subnetwork name zone
: Zone to where to build the project
workers
: how many workers will be built (default
: 3)
GOOGLE_CLOUD_PROJECT_NAME
: The project name
SERVICE_ACCOUNT_FILE
: The path of the json file
role
: values controller
, worker
To build 3 controller type nodes issue the next command to the console:
ansible-playbook -e role=controller build_up.yaml
To build 3 worker type nodes issue the next command to the console:
ansible-playbook -e role=worker build_up.yaml
To destroy 3 controllers issue next command to the console:
ansible-playbook -e role=controller tear_down.yaml
To build 3 worker type nodes issue the next command to the console:
ansible-playbook -e role=worker tear_down.yaml