Skip to content

aktonay/skillz / skills/cloud/gke-basics

gke-basics

Flagged

Plan, create, and configure production-ready Google Kubernetes Engine (GKE) clusters using the golden path Autopilot configuration. Covers Day-0 checklist, Autopilot vs Standard, networking (private clusters, VPC-native, Gateway API), security (Workload Identity, Secret Manager, RBAC hardening), observability, scaling, cost optimization, and AI/ML inference. WHEN: create GKE cluster, provision GKE environment, design GKE networking, secure GKE, optimize GKE cost, GKE autoscaling, GKE inference, GKE upgrade, GKE observability, GKE multi-tenancy, GKE batch, GKE HPC, GKE compute class.

references/iac-usage.md

View on GitHub
# GKE Infrastructure as Code

GKE resources, including clusters and Kubernetes objects, can be provisioned and
managed using Terraform.

## Terraform

Terraform uses two main providers for GKE:
*   The **Google Cloud provider** connects to the Google Cloud API to manage
    GKE cluster infrastructure using Terraform resources such as
    `google_container_cluster` for the cluster itself, and
    `google_container_node_pool` for nodes in Standard mode.
*   The **Kubernetes provider** connects to the Kubernetes API to manage
    workloads inside the cluster using Kubernetes resources such as
    Deployments and Services.


### GKE Autopilot Cluster Example

```hcl
resource "google_container_cluster" "primary" {
  name     = "my-gke-cluster"
  location = "us-central1"

  enable_autopilot = true

  # Do NOT specify node configurations (like initial_node_count or node_config)
  # in Autopilot mode; doing so causes a Terraform provider error.

  # Deletion protection should be set to false for testing
  deletion_protection = false
}
```

### Deploying a Workload Example (Kubernetes Provider)

```hcl
resource "kubernetes_deployment_v1" "default" {
  metadata {
    name = "hello-app"
  }
  spec {
    replicas = 2
    selector {
      match_labels = {
        app = "hello-app"
      }
    }
    template {
      metadata {
        labels = {
          app = "hello-app"
        }
      }
      spec {
        container {
          image = "us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0"
          name  = "hello-app"
        }
      }
    }
  }
}
```

### Reference Documentation

- [Terraform Google Provider - Container Cluster](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster)

- [Terraform Google Provider - Kubernetes Provider](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs)

## YAML Samples

GKE cluster configurations and Kubernetes manifests can also be defined using
YAML for use with `kubectl apply` or Deployment Manager.

- [GKE YAML Samples](https://docs.cloud.google.com/docs/samples?product=googlekubernetesengine)
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall