Git Product home page Git Product logo

gcp-devops-project's Introduction

GCP DevOps Project

This project deploys a simple Python Flask application to Google Kubernetes Engine (GKE) using Google Cloud Build and Google Artifact Registry. The application is exposed through an endpoint, allowing easy access.

Project Structure

  • app.py: Contains the Python Flask application code.
  • requirements.txt: Lists the dependencies required for the Flask application.
  • Dockerfile: Defines the Docker image build instructions.
  • cloudbuild.yaml: Configures the Google Cloud Build steps for building and deploying the Docker image.
  • gke.yaml: Specifies the Kubernetes deployment and service configurations for GKE.

Getting Started

To run this project locally or deploy it to GKE, follow these steps:

  1. Clone the repository:

    git clone https://github.com/guddev99/gcp-devops-project.git
  2. Navigate to the project directory:

    cd gcp-devops-project
  3. Ensure you have Docker installed:

  4. Build the Docker image locally:

    docker build -t gcpdevops .
  5. Run the Docker container locally:

    docker run -p 5000:5000 gcpdevops

    Access the Flask application at http://localhost:5000 in your web browser.

  6. To deploy to GKE, ensure you have a GKE cluster set up and configured. Create a new namespace:

    # Create a new namespace to isolate the deployment
    kubectl create namespace <namespace-name>

    Note: Creating a new namespace helps isolate the deployment within your Kubernetes cluster, ensuring better organization and management of resources.

  7. Update cloudbuild.yaml and gke.yaml with your GKE cluster details.

  8. Set up a Cloud Build Trigger connected with the project repository. This trigger should be configured to listen for pushes to the main/master branch.

    • Connect your project repository with Cloud Build by following the instructions provided in the Connecting to source repositories section of the Cloud Build documentation. connect-repository

    • Once your repository is connected, create a Cloud Build Trigger following the Creating a build trigger section of the Cloud Build documentation. connect-repository

    • You can refer to the screenshots provided, which were taken from the GCP console during the setup process.

  9. When changes are pushed to this branch, Cloud Build will automatically build the Docker image, push it to Google Artifact Registry, and deploy it to GKE.

  10. Access your deployed application through the endpoint provided by the GKE service.

Resources

Feel free to contribute to this project or customize it according to your requirements!

gcp-devops-project's People

Contributors

guddev99 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.