From 9736e287452bc665f4ee9cc5049c20b7ebb2c97d Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Mon, 6 Jan 2025 17:03:45 +0000 Subject: [PATCH] add initial gke scaffold Signed-off-by: Jack Luar --- .gitignore | 4 ++++ deploy/Makefile | 27 +++++++++++++++++++++++++++ deploy/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 deploy/Makefile create mode 100644 deploy/README.md diff --git a/.gitignore b/.gitignore index 0f9ba034..97748bf9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,7 @@ creds.json temp_test_run_data.json **/llm_tests_output.txt **/error_log.txt + +# deployment (Kompose files) +*-service.yaml +*-deployment.yaml diff --git a/deploy/Makefile b/deploy/Makefile new file mode 100644 index 00000000..6c8b66df --- /dev/null +++ b/deploy/Makefile @@ -0,0 +1,27 @@ +.PHONY: init + +init: + @echo "Initializing project..." + +format: + @echo "Formatting code..." + +check: + @echo "Checking code..." + +convert: + @echo "Converting docker-compose to kubernetes..." + @kompose convert -f ../docker-compose.yml + +gke-up: + @echo "Deploying to kubernetes..." + @kubectl apply -f . + +gke-down: + @echo "Undeploying from kubernetes..." + @kubectl delete -f . + +status: + @echo "Checking status of kubernetes deployment..." + @kubectl get pods -o json + @kubectl get services -o json diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 00000000..d4ff318a --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,42 @@ +# Deployment using Google Kubernetes Engine (GKE) + +Why GKE? This is to maintain a cloud-agnostic Kubernetes solution +which can be easily migrated to other services if needed. + +## Prerequisites + +0. Install `gcloud` CLI [(guide)](https://cloud.google.com/sdk/docs/install) and +`kompose` CLI for converting `docker-compose.yml` to Kubernetes manifests +[(guide)](https://kompose.io/installation/). + +Once installed, verify that these binaries are available: + +``` +kompose --version +gcloud --version +``` + +1. Authenticate GCP environment. + +```bash +gcloud auth login +gcloud config set project _PROJECT_ID_ +``` + +## Kubernetes configuration + +The infrastructure consists of two nodes, as follows: +- Backend: n1-standard-32 +- Frontend: n1-standard-16 +- other components... + +Refer to the Makefile for GKE deployment commands. This is specifically placed +in this folder to avoid confusion with the instructions in the root directory, +which creates a local deployment. + +```bash +make convert +make gke-up +make gke-down +make status +```