Skip to content

kinfinity/gke-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GKE Terraform

Infra ReleaseBuild & PushK8s Deploy Apps

This project aims to deploy a Kubernetes cluster on Google Cloud Platform (GCP) using Terraform. The infrastructure will include a load balancer for ingress, instances, and instance groups. Additionally, it will showcase the integration of a basic Next.js application, containerized with a small program rendering the Cohere logo on page load.

Requirements

TOOL   VERSION                 
Terraform v1.7.4                   
Python 3.12.2                  
GCloud   Google Cloud SDK 466.0.0 
Node   v20.11.1                

Project Structure

.
├── terraform/
│   ├── environments
│   |   └── dev
│   |       ├── main.tf
│   |       ├── provider.tf
│   |       ├── variables.tf
│   |       ├── state.tf
│   |       └── versions.tf
│   └── modules
│       ├── compute
│       └── network
├─ k8s
│   ├── charts
|   |   └── cohere-app
│   └── manifests
│       └── postgress.yaml
├── ci/
│   ├── configs
│   └── scripts
├── app/
│   ├── Dockerfile
│   └── cohere-app
│       ├── package.json
│       ├── package-lock.json
│       └── ...
├── README.md
└── ...

Build & Push

$ chmod +x ci/scripts/build-and-push-app.sh
$ python3 ci/scripts/build-and-push-all.py  --config ci/configs/pipeline-config.json --gitsha [GIT SHA] --registry gcr.io/[PROJECT_ID]

Run App

The App is a simple nextjs app for k8s cluster access testing purposes.

  • npm install

Build

This command builds the app for production

$ npm run build

Start

This command launches app with build configuration and files

$ npm run dev # runs in development mode and does not require pre-build
$ npm run start

Infrastructure as Code

IaC is setup with Terraform. resouce modules are build in the terraform/modules directory and consumed when building each sub environment in environment/[env]

Plan

$ python3 ci/scripts/execute-terraform.py --command plan --config ci/configs/pipeline-config.json --env dev

Apply

$ python3 ci/scripts/execute-terraform.py --command apply --config ci/configs/pipeline-config.json --env dev

About

Deploy GKE cluster with Terraform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published