kubernetes-cluster deploys a fully-functional Kubernetes Cluster in AWS using Terraform for provisioning and Ansible for configuration management.
AWS resources are provisioned by Terraform. Terraform state file is stored in AWS S3. Ansible's external dynamic inventory system gathers hosts data from the state file stored in S3 and deploys the Kubernetes cluster in the compute instances.
The Kubernetes cluster is composed by:
- Three etcd nodes
- Three Control Plane nodes
- At least three Worker nodes
The cluster is built taking into consideration AWS's high availability features. All nodes are distributed equally among three Availability Zones of a single region.
For simplicity and easy management purpose, kubernetes-cluster uses a single YAML configuration file to set all variables. A shell script calls j2cli which builds Terraform and Ansible configuration files based on Jinja2 templates, fetching variables from that single configuration file.
- Terraform 0.12.17
- Ansible 2.9.1
- boto
- j2cli
The settings are defined in the settings.yml
file.
- AWS Region
- Must have at least 3 Availability Zones
- The bucket to store the state file
- kubernetes_cluster does not handle bucket creation. Must be an existent bucket
- Reference: 1
- The path to store the Terraform state file inside the bucket
- kubernetes_cluster does not handle path creation. Must be an existent path
- Reference: 1
- The region of the AWS S3 Bucket where the Terraform state file will be stored
- Reference: 1
- Reference: 1
- Reference: 1
- Reference: 1
- Subnet A CIDR Block
- Reference: 1
- Subnet A Availability Zone
- Reference: 1
- Subnet B CIDR Block
- Reference: 1
- Subnet B Availability Zone
- Reference: 1
- Subnet C CIDR Block
- Reference: 1
- Subnet C Availability Zone
- Reference: 1
- etcd nodes
- Reference: 1
- Reference: 1
- Reference: 1
- Reference: 1
- Reference: 1
- Control Plane nodes
- Reference: 1
- Reference: 1
- Reference: 1
- Reference: 1
- Reference: 1
- Worker nodes
- Reference: 1
- Reference: 1
- Reference: 1
- The number of Worker instances per Availability Zone
- Reference: 1
- Reference: 1
- README.md :: boto
- README.md :: Document Ansible Dynamic Inventory - link1, link2, link3
- Add boto profiles support
- requirements.txt
- version.txt
- Replace the tag "kubernetes-cluster" by a variable
- boto profiles
- Add a bastion host
- Replace "master" by "control plane" (?)
- Terraform :: support placement groups
- Terraform :: ebs_optimized = true | Error launching source instance: Unsupported: EBS-optimized instances are not supported for your requested configuration. Please check the documentation for supported configurations.
- Terraform :: Add public and private subnets. Move the cluster to a private subnet
- Terraform :: Compute/EBS additional options, like volume_type and IOPS to root_block_device
- Terraform :: Compute, set subnet_id instead availability_zone in instances
- Terraform :: Remote state locking with DynamoDB
- Terraform :: Appropriate Security Group rules
- Terraform :: Add additional options for aws.nodes.etcd.root_block_device
- Ansible :: Enforce Kubernetes packages version
- Ansible :: Enforce Kubernetes packages version
- Ansible :: Packages marked as on hold are still being upgraded (double-check if this is happening and fix it)
- Ansible :: Double-check if the notifies are in the right place, order.
- Ansible :: Move control_plane : apply Weave Net CNI plugin shell command to a variable
- Ansible :: Allow the choice of other CNI plugins (?)
- Ansible :: Copy .kube/config to localhost.