Skip to content

Latest commit

 

History

History
73 lines (48 loc) · 2.01 KB

README.md

File metadata and controls

73 lines (48 loc) · 2.01 KB

terraform-k8s

Terraform Code and Scripts to Automate Kubernetes Setup using Kubeadm via Terraform (Compatible for Mac with M1 Chip)

For Vagrant Setup Please see vagrant-kubernetes

Documentation

To learn Kubernetes, please follow learn guide at suashk/

Prerequisites

  1. AWS Account.

  2. 3 EC2 Instances With the below Specification - a. Instance Type = "t2.medium" b. AMI = "ami-0fb653ca2d3203ac1"

  3. Public Subnet with CIDR - 10.0.1.0/16 (As this is being used for private IPs allocation as per point-4 and POD CIDR Range in K8s Cluster).

  4. Private IPs will be assigned as below -

image

  1. Security Group Settings - Please create or update your security group as per the below table -

image

  1. Update the values as per the below table -

image

Usage/Examples

To provision the cluster, execute the following commands.

git clone https://github.com/SuyashHashiCorp/terraform-k8s.git
cd terraform-k8s
terraform init
terraform plan
terraform apply

Set Kubeconfig file varaible.

"Terraform apply" will create the Kubernetes config file and store the information in your local system in the configs directory.

cd terraform-k8s
cd configs
cat config

Kubernetes login token

"Terraform apply" will create the admin user token and saves in the configs directory.

cd vagrant-kubeadm-kubernetes
cd configs
cat token

To destroy the cluster,

terraform destroy -auto-approve

To restart the cluster,

terraform apply -auto-approve