/DevOps-Terraform-Kubernetes-Python

A fun script to create and deploy a Python application running with Docker, using Terraform for Kubernetes Cluster provisioning in GCP, enjoy!

Primary LanguageShellMIT LicenseMIT

[DevOps-Automation] Terraform-Kubernetes-Python

A fun script to create and deploy a Python application, using Terraform for Kubernetes Cluster provisioning in GCP, enjoy!

Getting Started

This project are made using the following tools:

Platform Version
OS Windows 10 Pro
Bash Tool Git Bash
Code Editor Visual Studio Code

Prerequisites

Before running the project, make sure you have those applications:

  1. Docker Desktop
  2. GCloud SDK
  3. kubectl
  4. Helm
  5. Python
  6. jq

How to run

At the top of the 'main.sh' file replace the initial values with the GCP service account credentials.

  • GCP Project Name - Example: devops-manuel
GCP_PROJECT="PUT_GCP_PROJECT_HERE"
  • GCP Private Key ID - Example: 282b19cf817f43240aw984feaca8623aa29af233
GPC_PRIVATE_KEY_ID="PUT_GCP_PRIVATE_KEY_ID_HERE"
  • GCP Private Key - Example: -----BEGIN PRIVATE KEY-----\-----END PRIVATE KEY-----\n
GPC_PRIVATE_KEY="PUT_PRIVATE_KEY_HERE"
  • GCP Client Email - Example: gcp-devops@devop-manu.iam.gserviceaccount.com
GPC_CLIENT_MAIL="PUT_GCP_CLIENT_MAIL_HERE"
  • GCP Client ID - Example: 106512508332840639292
GPC_CLIENT_ID="PUT_GCP_CLIENT_ID_HERE"
  • GCP CLIENT X509 CERT URL - Example: https://www.googleapis.com/gcp-devops%40devop-manu.iam.gserviceaccount.com
GPC_CLIENT_CERT_URL="PUT_CLIENT_CERT_URL_HERE"

Deployment

Only one bash command line is needed to run the script:

sh .\src\main.sh

Testing

To test the two Python tendpoints, we need to open a new windows and use the following URL's. Change the Public IP's with those generated by the Kubernetes Cluster.

  1. /greetings:
http://34.68.146.239/greetings
  1. /square:
http://34.68.146.239/square?number=43

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details