Thanks to visit codestin.com
Credit goes to github.com

Skip to content

adarlan/kube-formation

Repository files navigation

Kube Formation

A project designed to practice and understand the Kubernetes architecture by setting up a cluster on Amazon EC2 instances. This project leverages Packer to create images for the cluster nodes, Terraform to provision the infrastructure, and Ansible to initialize the cluster.

Requirements

Ensure you have the following installed and configured before proceeding:

Setup Instructions

Follow the steps below to set up your Kubernetes cluster. Once finished, you can clean up the resources by deprovisioning the cluster infrastructure.

1. Build Node Image

Use Packer to create an Amazon Machine Image (AMI) for the cluster nodes. The AMI is based on Ubuntu and preconfigured with essential Kubernetes components (kubeadm, kubelet, kubectl and containerd) to simplify cluster initialization.

./packer-build.sh

2. Provision Infrastructure

Use Terraform to provision the cluster infrastructure, including three EC2 instances (one control plane and two worker nodes) along with an SSH key pair and security groups configured to enable node communication, SSH access, and service connectivity.

./terraform-apply.sh

3. Configure SSH

Prepare the private key, known hosts and Ansible inventory files. These will be used by Ansible to connect to the cluster nodes.

./ssh-config.sh

4. Initialize Cluster

Use Ansible to initialize and join the cluster nodes. Ansible will connect to the nodes and execute the kubeadm init on the control plane and kubeadm join on the workers to complete the cluster setup.

./ansible-playbook.sh

Shutdown & Cleanup

When finished, deprovision the cluster to avoid unnecessary costs.

1. Deprovision Infrastructure

Use Terraform to destroy the infrastructure, terminating instances and removing associated resources.

./terraform-destroy.sh

2. Deregister Node Image

Use the AWS CLI to deregister any AMIs created for this project and delete their associated EBS snapshots.

./ami-deregister.sh

Contributing

Contributions are welcome! If you’d like to improve this project, please submit a pull request or open an issue.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published