Skip to content

Cosmo-Tech/terraform-aws

Repository files navigation

Static Badge Static Badge

Kubernetes cluster

Requirements

  • working AWS account (with admin access)
  • Linux (Debian/Ubuntu) workstation with:

How to

  • configure aws cli
    aws configure
    
    • If you are using from AWS access portal
      • open "Access keys"
      • copy/paste aws_access_key_id, aws_secret_access_key and aws_session_token
    • ensure the connection is working
      aws sts get-caller-identity
      
  • clone current repo
    git clone https://github.com/Cosmo-Tech/terraform-aws.git
    
  • open cloned repository
    cd terraform-eks
    
  • deploy
    • fill terraform-cluster/terraform.tfvars variables according to your needs
    • run pre-configured script

      ℹ️ Comment/uncomment the terraform apply line at the end to get a plan without deploy anything

      ./_run-terraform.sh
      
    • add kubectl context
      aws eks update-kubeconfig --region cluster_region --name cluster_name --alias cluster_name
      
    • to be able to connect to cluster with kubectl, your current AWS user must have the right.

      Without good permissions, "system" node pool will also appear as "Unknown"

      • go to AWS > EKS > deployed cluster > Access
      • create an assignment
        • IAM principal ARN = your current user
        • Type = Standard
        • click on "Next"
        • Policy name = AmazonEKSClusterAdminPolicy
        • Access scope = Cluster
        • click on "Add policy"
        • click on "Create"
    • try a kubectl command to ensure the access is working
      kubectl get nodes
      

Developpers

  • modules

    • terraform-state-storage
      • standalone module intended to facilitate creation of a S3 storage (that will be used to store states of others modules)
      • state of this module itselft will not be saved, once created it should never be changed
      • manually create a S3 storage called "cosmotech-states" will have the same effect
    • terraform-cluster
      • dns = pre-configure DNS zones that will be required in next deployments
      • cluster = Kubernetes cluster
      • cluster-nodes = Kubernetes cluster nodes
  • global_variables.tf files contains wide used variables and are symbolics links to the main variables.tf (to avoid code duplication). copy/paste following block to ensure having global_variables.tf files in all child modules

    for module in $(ls terraform-cluster/modules/); do
        cd terraform-cluster/modules/$module
        ln -sf ../../variables.tf global_variables.tf
        cd ../../../
    done
    



Made with ❤️ by Cosmo Tech DevOps team

About

Kubernetes cluster - AWS

Resources

License

Stars

Watchers

Forks