Giter Site home page Giter Site logo

k8s_using_terraform_ansible's Introduction

Automating Kubernetes Cluster Deployment with Terraform and Ansible on Google Cloud Platform (GCP)

This project automates the provisioning of a Kubernetes cluster using Terraform and configures it with Ansible. It sets up one Kubernetes master node and two worker nodes on Google Cloud Platform (GCP). The infrastructure setup and configuration are fully automated, making it easy to deploy and manage a Kubernetes cluster.

Overview

Table of Contents

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • Terraform installed.
  • Ansible installed.
  • Google Cloud Platform Account: You need a GCP account with appropriate permissions to create and manage resources. Also, ensure that you have a JSON service account key file (terraform-gcp-provider-64fb3b5e93e3.json) for authentication.
  • SSH Key Pair: This configuration assumes you have an SSH key pair configured on your local machine. If not, you can generate one using ssh-keygen. Replace "~/.ssh/id_rsa.pub" in the configuration with the path to your public SSH key.

Getting Started

  1. Clone this repository to your local machine:

    git clone https://github.com/singhragvendra503/k8s_using_terraform_ansible.git
    cd k8s_using_terraform_ansible
  2. Put JSON service account key file (terraform-gcp-provider-64fb3b5e93e3.json) for authentication.

  3.  terraform init
    
     terraform validate
    
     terrafrom plan
    
     terrafrom apply --auto-approve
  4. Give execution permission to the dynamic_inventory.sh file and run it. It will set hosts in the Ansible hosts file at /etc/ansible/hosts.

    ./dynamic_inventry.sh
  5. Finally run

    ansible-playbook main_playbook.yaml
  6. For varification run some command in k8s master

    kubectl get nodes
    
    kubectl get pods -A
    

Scan Policy Validation Using terrascan

policy validation summry

Mothly Cost Calculated Using infracost

Cost

k8s_using_terraform_ansible's People

Contributors

singhragvendra503 avatar

Stargazers

 avatar

Watchers

 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.