Skip to content

Latest commit

 

History

History
87 lines (54 loc) · 4.07 KB

README.md

File metadata and controls

87 lines (54 loc) · 4.07 KB

AWS-Self-Maneged-Kubernetes

This repository helps to build a self-managed Kubenetes cluster on AWS infrastructure using Terraform with Jenkins pipeline. Then, Ansible is used to configure Kubernetes and install Helm, Istio, and run microservices on the master node. How to use this repository is coming very soon.

Social Network Microservices

A social network with unidirectional follow relationships, developed using microservices with loose coupling that communicate over Thrift RPCs. Application Structure

socialNet_arch

Ref: https://github.com/delimitrou/DeathStarBench

AWS Architecture

Untitled Diagram drawio

Jenkins

Jenkins and Terraform and AWS

Screen Shot 2021-07-01 at 4 43 17 PM

Install Terraform plugin

To Install Terraform plugin,

Go to Manage Jenkins > Manage Plugins >Available > search Terraform > Choose to install Terraform plugin.

Add AWS Credentiols

To configure AWS credentials in Jenkins:

  1. Install Pipeline: AWS Steps navigate to Manage Jenkins > Manage Plugins under the Available tab of the Jenkins dashboard. Choose to install the Pipeline: AWS Steps plugin without a restart.

  2. Add Aws credentials: You can add credentials by navigating to Manage Jenkins > Manage Credentials > Jenkins (global) > Global Credentials > Add Credentials. Choose kind as AWS credentials and enter "terraform-credentials" as the ID. Enter the access key ID and access key secret, then select OK. 1cred Note! if you can not see the AWS credentials after adding the plugin. please go to Manage Jenkins > Configure Credential Providers > change Providers to all available and change types to all availlable. 2 credentioalproviders

Add Terraform Pipeline

To add Terraform Pipeline, Go to new item > Enter an item name > choose Pipline > Click OK. Then, To add Jenkinsfile: Go to Advanced Project Options > In Pipline Section > Select "Pipline script from SCM" . > Select "Git" in SCM section > Insert Repository URL (https://github.com/Omidznlp/AWS-Self-Maneged-Kubernetes.git) in Repositoriis Section

pipe1

In Section Branches to build, Insert (*/master) > In Script Path, Insert (terraform/Jenkinsfile) > Click Save.

pip2

Jenkins Nodes Label

I used agent with "master" label to build Terraform Pipile, In Jenkinsfile into repositoy you can find it.

    agent {
      node {
        label "master"
      } 
`    }

I gave my Jenkins server the label "master," and then I ran Terraform on it. Go to Manage Jenkins > Click "Manage nodes and clouds" > Select setting (left side of the list of nodes) > Under the label section, add "master" > Save it.

nodelabel

Note! Simply, you can change the label on the Jenkinsfile or choose your node from your node lists from which you would like to execute terraform and then add the "master" label to it.

Run Jenkins Pipline

Build with parameters: choose an action "apply or destroy"?

param-1

Before "TF Apply" or TF Destroy" stage, you must approve it manually in the Approval and Removal Stage by clicking on it and selecting "Proceed.". param-2

Ansible