Git Product home page Git Product logo

backend-infrastructure's Introduction

SUMMARY

This repository is used to define core Networking and Kubernetes Cluster Infrastructure.

PRE-REQUISITES

TOOLS OF THE TRADE

  • awscli
  • helm (Helm 3 cli)
  • kubectl
  • argocd cli

CORE COMPONENTS

  • Networking - 2 Tier VPC (Public, Private)
  • EKS - Managed Kubernetes Service
  • Charts - Install required helm charts upon cluster creation

CREATING A NEW ENVIRONMENT

An environment its a combination of the following modules:

  • network - 2 tier network setup
  • eks - the majority of EKS cluster set up occurs here. AWS resources and some core helm charts
  • charts - all the helm charts(Nginx Controller, ArgoCD) to be installed after cluster creation.

Authentication

Currently configure to read a local AWS PROFILE, but can be switch to any Terraform AWS Provider Authentication Method once Terraform Cloud is used.

Terraform Structure

There is one .tfvars file for each environment and it needs to be referred with --var-file=[environment].tfvars during apply/destroy Terraform states are stored remotely in AWS S3(Precreated Bucket)

Running the project

terraform fmt -recursive
terraform init
terraform validate
terraform apply --var-file=[environment].tfvars

Configuring your environment

  1. Update your kubeconfig file so you can start administrating the cluster using kubectl with the following command

    aws --profile eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)

  2. Get the initial generated password for argocd Admin user

    argocd admin initial-password

  3. Generate SSH Keys for github - github guide
  4. Import your public key to github
  5. Iclude your github private key in the provided "application.yml" file under the secret resource.
  6. Push a new commit to your server repo to trigger the Github actions pipeline in order to build and push a new image to the ECR repository within your newly created infrastructure
  7. Apply the "application.yml" file

    kubectl apply -f application.yml

DESTROYING THE CLUSTER

terraform destroy

remember to remove the cluster from your ~/.kube/config

Exceptions

  • Applications that have issues resources outside K8S such as Load Balancers, DNS Entries may remain upon the cluster deletion and may hang terraform destroy. You will need to manually delete those resources.

IMPROVEMENTS FROM ORIGINAL ITERATION

TO-DO

  • Deploy Argo resources in different namespace than the default one
  • Store the Private SSH key in AWS Secrets Manager/Parameter Store
  • Deploy External Secrets Operator to create Kubernetes secrets by integrating with AWS Secrets Manager/Parameter Store

backend-infrastructure's People

Contributors

mohamedhajr avatar alexeyis avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.