$ cat ./deployments/gke.md

Google Kubernetes Engine (GKE)

Deploying to GKE involves creating a container image, pushing it to a registry (like GCR or Artifact Registry), and then using Kubernetes manifests to deploy it.

Steps

  1. Containerize: Ensure the application has a valid Dockerfile.

  2. Build & Push:

    docker build -t gcr.io/my-project/cv-website:v1 .
    docker push gcr.io/my-project/cv-website:v1
    
  3. Helm Chart: Create a Helm chart to manage the deployment.

    • deployment.yaml: Defines the Pods and Replicas.
    • service.yaml: Exposes the application (LoadBalancer or NodePort).
    • ingress.yaml: Manages external access (if using an Ingress Controller).
  4. Terraform: Use Terraform to provision the GKE cluster and deploy the Helm chart.

    resource "google_container_cluster" "primary" {
      name     = "cv-cluster"
      location = "us-central1"
      # ... configuration ...
    }
    
    resource "helm_release" "cv_website" {
      name       = "cv-website"
      repository = "./charts"
      chart      = "cv-website"
      # ... values ...
    }