opencode-skills-collection 4.0.68 → 4.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-skills/.antigravity-install-manifest.json +266 -1
- package/bundled-skills/access-review/SKILL.md +394 -0
- package/bundled-skills/access-review/references/details.md +121 -0
- package/bundled-skills/agent-evals/SKILL.md +420 -0
- package/bundled-skills/agent-observability/SKILL.md +346 -0
- package/bundled-skills/agent-observability/references/details.md +786 -0
- package/bundled-skills/ai-agent-security/SKILL.md +393 -0
- package/bundled-skills/ai-agent-security/references/details.md +912 -0
- package/bundled-skills/ai-coding-agent-guardrails/SKILL.md +442 -0
- package/bundled-skills/ai-coding-agent-guardrails/references/details.md +753 -0
- package/bundled-skills/ai-inference-service-mesh/SKILL.md +449 -0
- package/bundled-skills/ai-pipeline-orchestration/SKILL.md +287 -0
- package/bundled-skills/ai-red-teaming/SKILL.md +409 -0
- package/bundled-skills/ai-security-hardening/SKILL.md +343 -0
- package/bundled-skills/ai-sre-incident-response/SKILL.md +336 -0
- package/bundled-skills/alerting-oncall/SKILL.md +458 -0
- package/bundled-skills/alerting-oncall/references/details.md +84 -0
- package/bundled-skills/apk-redteam-pipeline/SKILL.md +446 -0
- package/bundled-skills/argocd-gitops/SKILL.md +469 -0
- package/bundled-skills/arm-templates/SKILL.md +438 -0
- package/bundled-skills/arm-templates/references/details.md +64 -0
- package/bundled-skills/asset-inventory/SKILL.md +412 -0
- package/bundled-skills/asset-inventory/references/details.md +127 -0
- package/bundled-skills/audit-logging/SKILL.md +476 -0
- package/bundled-skills/aws-cloudtrail/SKILL.md +486 -0
- package/bundled-skills/aws-cost-optimization/SKILL.md +331 -0
- package/bundled-skills/aws-ec2/SKILL.md +426 -0
- package/bundled-skills/aws-ecs-fargate/SKILL.md +388 -0
- package/bundled-skills/aws-iam/SKILL.md +463 -0
- package/bundled-skills/aws-lambda/SKILL.md +428 -0
- package/bundled-skills/aws-rds/SKILL.md +380 -0
- package/bundled-skills/aws-s3/SKILL.md +434 -0
- package/bundled-skills/aws-secrets-manager/SKILL.md +486 -0
- package/bundled-skills/aws-vpc/SKILL.md +436 -0
- package/bundled-skills/azure-ai-document-intelligence-ts/SKILL.md +1 -1
- package/bundled-skills/azure-aks/SKILL.md +423 -0
- package/bundled-skills/azure-devops/SKILL.md +457 -0
- package/bundled-skills/azure-functions-devsec/SKILL.md +436 -0
- package/bundled-skills/azure-keyvault/SKILL.md +455 -0
- package/bundled-skills/azure-keyvault/references/details.md +83 -0
- package/bundled-skills/azure-monitor-audit/SKILL.md +379 -0
- package/bundled-skills/azure-networking/SKILL.md +448 -0
- package/bundled-skills/azure-networking/references/details.md +135 -0
- package/bundled-skills/azure-sql/SKILL.md +413 -0
- package/bundled-skills/azure-sql/references/details.md +113 -0
- package/bundled-skills/azure-vms/SKILL.md +402 -0
- package/bundled-skills/azure-vms/references/details.md +134 -0
- package/bundled-skills/backup-recovery/SKILL.md +388 -0
- package/bundled-skills/bb-methodology/SKILL.md +451 -0
- package/bundled-skills/bb-methodology/references/details.md +120 -0
- package/bundled-skills/block-storage/SKILL.md +371 -0
- package/bundled-skills/blue-green-deploy/SKILL.md +453 -0
- package/bundled-skills/blue-green-deploy/references/details.md +90 -0
- package/bundled-skills/bug-bounty/SKILL.md +447 -0
- package/bundled-skills/bug-bounty/references/details.md +1316 -0
- package/bundled-skills/bugcrowd-reporting/SKILL.md +351 -0
- package/bundled-skills/business-continuity/SKILL.md +463 -0
- package/bundled-skills/career-ops/SKILL.md +186 -0
- package/bundled-skills/cdn-setup/SKILL.md +374 -0
- package/bundled-skills/change-management/SKILL.md +438 -0
- package/bundled-skills/change-management/references/details.md +105 -0
- package/bundled-skills/circleci/SKILL.md +475 -0
- package/bundled-skills/cis-benchmarks/SKILL.md +150 -0
- package/bundled-skills/cloudflare-pages/SKILL.md +318 -0
- package/bundled-skills/cloudflare-r2/SKILL.md +353 -0
- package/bundled-skills/cloudflare-workers/SKILL.md +415 -0
- package/bundled-skills/cloudflare-zero-trust/SKILL.md +361 -0
- package/bundled-skills/cloudformation/SKILL.md +461 -0
- package/bundled-skills/constraint-driven-development/SKILL.md +335 -0
- package/bundled-skills/constraint-driven-development/references/floor-guard.md +99 -0
- package/bundled-skills/container-hardening/SKILL.md +126 -0
- package/bundled-skills/container-registries/SKILL.md +435 -0
- package/bundled-skills/container-scanning/SKILL.md +416 -0
- package/bundled-skills/convex-backend/SKILL.md +338 -0
- package/bundled-skills/dast-scanning/SKILL.md +437 -0
- package/bundled-skills/database-backups/SKILL.md +425 -0
- package/bundled-skills/datadog/SKILL.md +487 -0
- package/bundled-skills/dependency-scanning/SKILL.md +457 -0
- package/bundled-skills/devcontainers-nix/SKILL.md +416 -0
- package/bundled-skills/disaster-recovery/SKILL.md +374 -0
- package/bundled-skills/disaster-recovery/references/details.md +219 -0
- package/bundled-skills/dns-management/SKILL.md +375 -0
- package/bundled-skills/docker-compose/SKILL.md +482 -0
- package/bundled-skills/docker-management/SKILL.md +426 -0
- package/bundled-skills/ebpf-observability/SKILL.md +436 -0
- package/bundled-skills/ebpf-observability/references/details.md +542 -0
- package/bundled-skills/elk-stack/SKILL.md +487 -0
- package/bundled-skills/enterprise-vpn-attack/SKILL.md +395 -0
- package/bundled-skills/evidence-hygiene/SKILL.md +404 -0
- package/bundled-skills/feature-flags/SKILL.md +426 -0
- package/bundled-skills/feature-flags/references/details.md +86 -0
- package/bundled-skills/fedramp-compliance/SKILL.md +453 -0
- package/bundled-skills/firebase-app-platform/SKILL.md +381 -0
- package/bundled-skills/firewall-config/SKILL.md +479 -0
- package/bundled-skills/gcp-audit-logs/SKILL.md +452 -0
- package/bundled-skills/gcp-audit-logs/references/details.md +56 -0
- package/bundled-skills/gcp-cloud-functions/SKILL.md +284 -0
- package/bundled-skills/gcp-cloud-sql/SKILL.md +277 -0
- package/bundled-skills/gcp-compute/SKILL.md +319 -0
- package/bundled-skills/gcp-gke/SKILL.md +307 -0
- package/bundled-skills/gcp-networking/SKILL.md +293 -0
- package/bundled-skills/gcp-secret-manager/SKILL.md +421 -0
- package/bundled-skills/gcp-secret-manager/references/details.md +131 -0
- package/bundled-skills/gdpr-compliance/SKILL.md +451 -0
- package/bundled-skills/gdpr-compliance/references/details.md +145 -0
- package/bundled-skills/geo-audit/SKILL.md +368 -0
- package/bundled-skills/geo-brand-mentions/SKILL.md +68 -0
- package/bundled-skills/geo-brand-mentions/references/details.md +471 -0
- package/bundled-skills/geo-citability/SKILL.md +350 -0
- package/bundled-skills/geo-compare/SKILL.md +340 -0
- package/bundled-skills/geo-content/SKILL.md +383 -0
- package/bundled-skills/geo-crawlers/SKILL.md +408 -0
- package/bundled-skills/geo-llmstxt/SKILL.md +464 -0
- package/bundled-skills/geo-platform-optimizer/SKILL.md +314 -0
- package/bundled-skills/geo-proposal/SKILL.md +378 -0
- package/bundled-skills/geo-prospect/SKILL.md +225 -0
- package/bundled-skills/geo-report/SKILL.md +436 -0
- package/bundled-skills/geo-report-pdf/SKILL.md +157 -0
- package/bundled-skills/geo-schema/SKILL.md +408 -0
- package/bundled-skills/geo-technical/SKILL.md +78 -0
- package/bundled-skills/geo-technical/references/details.md +543 -0
- package/bundled-skills/git-workflow/SKILL.md +460 -0
- package/bundled-skills/github-actions/SKILL.md +368 -0
- package/bundled-skills/gitlab-ci/SKILL.md +340 -0
- package/bundled-skills/gpu-kubernetes-operations/SKILL.md +468 -0
- package/bundled-skills/gpu-server-management/SKILL.md +236 -0
- package/bundled-skills/hashicorp-vault/SKILL.md +408 -0
- package/bundled-skills/helm-charts/SKILL.md +469 -0
- package/bundled-skills/hipaa-compliance/SKILL.md +451 -0
- package/bundled-skills/hunt-aspnet/SKILL.md +321 -0
- package/bundled-skills/hunt-ato/SKILL.md +184 -0
- package/bundled-skills/hunt-auth-bypass/SKILL.md +426 -0
- package/bundled-skills/hunt-auth-bypass/references/details.md +80 -0
- package/bundled-skills/hunt-brute-force/SKILL.md +341 -0
- package/bundled-skills/hunt-business-logic/SKILL.md +281 -0
- package/bundled-skills/hunt-cache-poison/SKILL.md +382 -0
- package/bundled-skills/hunt-captcha-bypass/SKILL.md +136 -0
- package/bundled-skills/hunt-cicd/SKILL.md +311 -0
- package/bundled-skills/hunt-clickjacking/SKILL.md +110 -0
- package/bundled-skills/hunt-cors/SKILL.md +335 -0
- package/bundled-skills/hunt-dom/SKILL.md +323 -0
- package/bundled-skills/hunt-exceptional-conditions/SKILL.md +111 -0
- package/bundled-skills/hunt-file-upload/SKILL.md +202 -0
- package/bundled-skills/hunt-fintech-graphql/SKILL.md +289 -0
- package/bundled-skills/hunt-forgot-password/SKILL.md +114 -0
- package/bundled-skills/hunt-grpc/SKILL.md +317 -0
- package/bundled-skills/hunt-host-header/SKILL.md +309 -0
- package/bundled-skills/hunt-html-injection/SKILL.md +106 -0
- package/bundled-skills/hunt-http-smuggling/SKILL.md +129 -0
- package/bundled-skills/hunt-http-smuggling/references/phase2h-smuggling-cachepoison.md +177 -0
- package/bundled-skills/hunt-idor/SKILL.md +434 -0
- package/bundled-skills/hunt-jwt-crypto/SKILL.md +221 -0
- package/bundled-skills/hunt-k8s/SKILL.md +337 -0
- package/bundled-skills/hunt-laravel/SKILL.md +255 -0
- package/bundled-skills/hunt-ldap/SKILL.md +351 -0
- package/bundled-skills/hunt-lfi/SKILL.md +311 -0
- package/bundled-skills/hunt-llm-ai/SKILL.md +289 -0
- package/bundled-skills/hunt-mfa-bypass/SKILL.md +177 -0
- package/bundled-skills/hunt-misc/SKILL.md +378 -0
- package/bundled-skills/hunt-nextjs/SKILL.md +299 -0
- package/bundled-skills/hunt-nodejs/SKILL.md +263 -0
- package/bundled-skills/hunt-nosqli/SKILL.md +210 -0
- package/bundled-skills/hunt-ntlm-info/SKILL.md +314 -0
- package/bundled-skills/hunt-oauth/SKILL.md +459 -0
- package/bundled-skills/hunt-open-redirect/SKILL.md +223 -0
- package/bundled-skills/hunt-race-condition/SKILL.md +381 -0
- package/bundled-skills/hunt-race-condition/references/details.md +159 -0
- package/bundled-skills/hunt-rag-vector/SKILL.md +212 -0
- package/bundled-skills/hunt-rce/SKILL.md +444 -0
- package/bundled-skills/hunt-rce/references/details.md +110 -0
- package/bundled-skills/hunt-saml/SKILL.md +156 -0
- package/bundled-skills/hunt-session/SKILL.md +342 -0
- package/bundled-skills/hunt-shadow-api/SKILL.md +198 -0
- package/bundled-skills/hunt-source-leak/SKILL.md +345 -0
- package/bundled-skills/hunt-spa-api/SKILL.md +163 -0
- package/bundled-skills/hunt-springboot/SKILL.md +285 -0
- package/bundled-skills/hunt-sqli/SKILL.md +466 -0
- package/bundled-skills/hunt-ssrf/SKILL.md +396 -0
- package/bundled-skills/hunt-ssrf/references/details.md +179 -0
- package/bundled-skills/hunt-ssti/SKILL.md +163 -0
- package/bundled-skills/hunt-subdomain/SKILL.md +379 -0
- package/bundled-skills/hunt-tls-network/SKILL.md +399 -0
- package/bundled-skills/hunt-xxe/SKILL.md +466 -0
- package/bundled-skills/i-have-adhd/SKILL.md +170 -0
- package/bundled-skills/identity-access-management/SKILL.md +382 -0
- package/bundled-skills/identity-access-management/references/details.md +524 -0
- package/bundled-skills/incident-management/SKILL.md +484 -0
- package/bundled-skills/incident-response/SKILL.md +448 -0
- package/bundled-skills/incident-response/references/details.md +113 -0
- package/bundled-skills/interview-me/SKILL.md +248 -0
- package/bundled-skills/iso27001-compliance/SKILL.md +460 -0
- package/bundled-skills/jenkins/SKILL.md +462 -0
- package/bundled-skills/jev-use/SKILL.md +158 -0
- package/bundled-skills/kubernetes-hardening/SKILL.md +154 -0
- package/bundled-skills/kubernetes-ops/SKILL.md +449 -0
- package/bundled-skills/kubernetes-ops/references/details.md +108 -0
- package/bundled-skills/kustomize/SKILL.md +478 -0
- package/bundled-skills/linux-administration/SKILL.md +367 -0
- package/bundled-skills/linux-hardening/SKILL.md +154 -0
- package/bundled-skills/llm-app-security/SKILL.md +389 -0
- package/bundled-skills/llm-app-security/references/details.md +674 -0
- package/bundled-skills/llm-caching/SKILL.md +334 -0
- package/bundled-skills/llm-cost-optimization/SKILL.md +311 -0
- package/bundled-skills/llm-fine-tuning/SKILL.md +329 -0
- package/bundled-skills/llm-gateway/SKILL.md +282 -0
- package/bundled-skills/llm-inference-scaling/SKILL.md +286 -0
- package/bundled-skills/llmops-platform-engineering/SKILL.md +472 -0
- package/bundled-skills/load-balancing/SKILL.md +403 -0
- package/bundled-skills/loki-logging/SKILL.md +479 -0
- package/bundled-skills/m365-entra-attack/SKILL.md +423 -0
- package/bundled-skills/mac-mini-llm-lab/SKILL.md +350 -0
- package/bundled-skills/mcp-server-security/SKILL.md +356 -0
- package/bundled-skills/mcp-server-security/references/details.md +745 -0
- package/bundled-skills/mdm-device-management/SKILL.md +404 -0
- package/bundled-skills/mdm-device-management/references/details.md +410 -0
- package/bundled-skills/meme-coin-audit/SKILL.md +402 -0
- package/bundled-skills/mid-engagement-ir-detection/SKILL.md +377 -0
- package/bundled-skills/model-registry-governance/SKILL.md +452 -0
- package/bundled-skills/model-serving-kubernetes/SKILL.md +339 -0
- package/bundled-skills/model-supply-chain-security/SKILL.md +427 -0
- package/bundled-skills/mongodb/SKILL.md +436 -0
- package/bundled-skills/multi-tenant-llm-hosting/SKILL.md +435 -0
- package/bundled-skills/multi-tenant-llm-hosting/references/details.md +211 -0
- package/bundled-skills/mysql/SKILL.md +390 -0
- package/bundled-skills/new-relic/SKILL.md +472 -0
- package/bundled-skills/nfs-storage/SKILL.md +356 -0
- package/bundled-skills/object-storage/SKILL.md +378 -0
- package/bundled-skills/offensive-osint/SKILL.md +443 -0
- package/bundled-skills/okta-attack/SKILL.md +436 -0
- package/bundled-skills/ollama-stack/SKILL.md +379 -0
- package/bundled-skills/openclaw-deployment-hardening/SKILL.md +135 -0
- package/bundled-skills/openclaw-local-mac-mini/SKILL.md +426 -0
- package/bundled-skills/openclaw-local-mac-mini/references/details.md +221 -0
- package/bundled-skills/openclaw-security-hardening/SKILL.md +135 -0
- package/bundled-skills/openshift/SKILL.md +485 -0
- package/bundled-skills/opentelemetry/SKILL.md +438 -0
- package/bundled-skills/opentelemetry/references/details.md +78 -0
- package/bundled-skills/opentofu-migration/SKILL.md +349 -0
- package/bundled-skills/osint-methodology/SKILL.md +460 -0
- package/bundled-skills/osint-methodology/references/details.md +1350 -0
- package/bundled-skills/pci-dss-compliance/SKILL.md +446 -0
- package/bundled-skills/penetration-testing/SKILL.md +152 -0
- package/bundled-skills/performance-tuning/SKILL.md +381 -0
- package/bundled-skills/planetscale/SKILL.md +297 -0
- package/bundled-skills/platform-engineering/SKILL.md +348 -0
- package/bundled-skills/platform-engineering/references/details.md +944 -0
- package/bundled-skills/podman/SKILL.md +405 -0
- package/bundled-skills/policy-as-code/SKILL.md +434 -0
- package/bundled-skills/policy-as-code/references/details.md +204 -0
- package/bundled-skills/postgresql-devsec/SKILL.md +378 -0
- package/bundled-skills/prometheus-grafana/SKILL.md +469 -0
- package/bundled-skills/prompt-injection-defense/SKILL.md +483 -0
- package/bundled-skills/rag-infrastructure/SKILL.md +269 -0
- package/bundled-skills/rag-observability-evals/SKILL.md +444 -0
- package/bundled-skills/rag-observability-evals/references/details.md +92 -0
- package/bundled-skills/recon-scope-triage/SKILL.md +128 -0
- package/bundled-skills/redis/SKILL.md +421 -0
- package/bundled-skills/redteam-report-template/SKILL.md +370 -0
- package/bundled-skills/report-writing/SKILL.md +426 -0
- package/bundled-skills/report-writing/references/details.md +187 -0
- package/bundled-skills/reverse-proxy/SKILL.md +420 -0
- package/bundled-skills/runbook-creation/SKILL.md +438 -0
- package/bundled-skills/runbook-creation/references/details.md +71 -0
- package/bundled-skills/saas-security-posture/SKILL.md +415 -0
- package/bundled-skills/sast-scanning/SKILL.md +444 -0
- package/bundled-skills/sbom-supply-chain/SKILL.md +433 -0
- package/bundled-skills/security-arsenal/SKILL.md +446 -0
- package/bundled-skills/security-arsenal/references/details.md +540 -0
- package/bundled-skills/security-automation/SKILL.md +146 -0
- package/bundled-skills/semantic-versioning/SKILL.md +434 -0
- package/bundled-skills/semantic-versioning/references/details.md +83 -0
- package/bundled-skills/service-mesh/SKILL.md +422 -0
- package/bundled-skills/soc2-compliance/SKILL.md +409 -0
- package/bundled-skills/sops-encryption/SKILL.md +124 -0
- package/bundled-skills/sre-dashboards/SKILL.md +143 -0
- package/bundled-skills/ssh-configuration/SKILL.md +324 -0
- package/bundled-skills/ssl-tls-management/SKILL.md +428 -0
- package/bundled-skills/ssl-tls-management/references/details.md +99 -0
- package/bundled-skills/startup-it-troubleshooting/SKILL.md +415 -0
- package/bundled-skills/supply-chain-attack-recon/SKILL.md +453 -0
- package/bundled-skills/supply-chain-attack-recon/references/details.md +258 -0
- package/bundled-skills/systemd-services/SKILL.md +379 -0
- package/bundled-skills/terraform-aws/SKILL.md +125 -0
- package/bundled-skills/terraform-azure/SKILL.md +415 -0
- package/bundled-skills/terraform-azure/references/details.md +231 -0
- package/bundled-skills/terraform-gcp/SKILL.md +369 -0
- package/bundled-skills/threat-modeling/SKILL.md +487 -0
- package/bundled-skills/user-management/SKILL.md +383 -0
- package/bundled-skills/using-agent-skills/SKILL.md +220 -0
- package/bundled-skills/vector-database-ops/SKILL.md +300 -0
- package/bundled-skills/vendor-management/SKILL.md +439 -0
- package/bundled-skills/vendor-management/references/details.md +109 -0
- package/bundled-skills/vercel-deployments/SKILL.md +296 -0
- package/bundled-skills/vllm-server/SKILL.md +236 -0
- package/bundled-skills/vmware-vcenter-attack/SKILL.md +412 -0
- package/bundled-skills/vpn-setup/SKILL.md +452 -0
- package/bundled-skills/vulnerability-scanning/SKILL.md +448 -0
- package/bundled-skills/waf-setup/SKILL.md +354 -0
- package/bundled-skills/waf-setup/references/details.md +211 -0
- package/bundled-skills/web2-recon/SKILL.md +440 -0
- package/bundled-skills/web2-recon/references/details.md +319 -0
- package/bundled-skills/web3-audit/SKILL.md +445 -0
- package/bundled-skills/web3-audit/references/details.md +224 -0
- package/bundled-skills/windows-hardening/SKILL.md +454 -0
- package/bundled-skills/windows-hardening/references/details.md +204 -0
- package/bundled-skills/windows-server/SKILL.md +318 -0
- package/bundled-skills/zero-trust/SKILL.md +461 -0
- package/package.json +1 -1
- package/skills_index.json +6943 -323
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gcp-compute
|
|
3
|
+
description: Manage Compute Engine instances and instance templates. Configure managed
|
|
4
|
+
instance groups and preemptible VMs. Use when deploying compute resources on GCP.
|
|
5
|
+
category: devops
|
|
6
|
+
risk: critical
|
|
7
|
+
source: https://github.com/BagelHole/DevOps-Security-Agent-Skills
|
|
8
|
+
source_repo: BagelHole/DevOps-Security-Agent-Skills
|
|
9
|
+
source_type: community
|
|
10
|
+
date_added: '2026-09-20'
|
|
11
|
+
license: MIT
|
|
12
|
+
license_source: https://github.com/BagelHole/DevOps-Security-Agent-Skills/blob/main/LICENSE
|
|
13
|
+
compatibility: Requires the relevant OS/platform tooling and privileged access where
|
|
14
|
+
noted. Docs-only; helper scripts and templates not bundled.
|
|
15
|
+
metadata:
|
|
16
|
+
author: devops-skills
|
|
17
|
+
version: '1.0'
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# GCP Compute Engine
|
|
21
|
+
|
|
22
|
+
Deploy, manage, and scale Compute Engine virtual machines on Google Cloud Platform.
|
|
23
|
+
|
|
24
|
+
## When to Use
|
|
25
|
+
|
|
26
|
+
- Deploying web servers, application backends, or batch-processing workloads on GCP
|
|
27
|
+
- Running workloads that need full OS-level control (unlike Cloud Run or App Engine)
|
|
28
|
+
- Creating managed instance groups for auto-healing and auto-scaling behind a load balancer
|
|
29
|
+
- Provisioning GPU-attached VMs for ML training or rendering pipelines
|
|
30
|
+
- Cost-optimizing non-critical workloads with preemptible or spot VMs
|
|
31
|
+
|
|
32
|
+
## Prerequisites
|
|
33
|
+
|
|
34
|
+
- Google Cloud SDK (`gcloud`) installed and authenticated
|
|
35
|
+
- A GCP project with the Compute Engine API enabled
|
|
36
|
+
- IAM role `roles/compute.admin` or scoped roles for instance management
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gcloud auth list
|
|
40
|
+
gcloud config set project $PROJECT_ID
|
|
41
|
+
gcloud services enable compute.googleapis.com
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Machine Types Reference
|
|
45
|
+
|
|
46
|
+
| Family | Example | vCPUs | Memory | Use Case |
|
|
47
|
+
|--------|---------|-------|--------|----------|
|
|
48
|
+
| E2 | e2-micro | 0.25 | 1 GB | Dev/test, microservices |
|
|
49
|
+
| E2 | e2-medium | 1 | 4 GB | Light web servers |
|
|
50
|
+
| N2 | n2-standard-4 | 4 | 16 GB | General-purpose production |
|
|
51
|
+
| N2 | n2-highmem-8 | 8 | 64 GB | In-memory caches, databases |
|
|
52
|
+
| C2 | c2-standard-16 | 16 | 64 GB | Compute-intensive, HPC |
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# List machine types available in a zone
|
|
56
|
+
gcloud compute machine-types list --zones=us-central1-a --filter="name~'e2-'"
|
|
57
|
+
|
|
58
|
+
# Create a custom machine type (6 vCPUs, 24 GB RAM)
|
|
59
|
+
gcloud compute instances create custom-vm \
|
|
60
|
+
--custom-cpu=6 --custom-memory=24GB \
|
|
61
|
+
--zone=us-central1-a \
|
|
62
|
+
--image-family=debian-12 --image-project=debian-cloud
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Create an Instance
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Production instance with shielded VM and startup script
|
|
69
|
+
gcloud compute instances create web-server \
|
|
70
|
+
--machine-type=e2-medium \
|
|
71
|
+
--zone=us-central1-a \
|
|
72
|
+
--image-family=debian-12 \
|
|
73
|
+
--image-project=debian-cloud \
|
|
74
|
+
--boot-disk-size=20GB \
|
|
75
|
+
--boot-disk-type=pd-balanced \
|
|
76
|
+
--tags=http-server,https-server \
|
|
77
|
+
--labels=env=production,team=backend \
|
|
78
|
+
--metadata=enable-oslogin=TRUE \
|
|
79
|
+
--shielded-secure-boot \
|
|
80
|
+
--shielded-vtpm \
|
|
81
|
+
--shielded-integrity-monitoring
|
|
82
|
+
|
|
83
|
+
# Instance with a startup script and service account
|
|
84
|
+
gcloud compute instances create app-server \
|
|
85
|
+
--machine-type=e2-standard-2 \
|
|
86
|
+
--zone=us-central1-a \
|
|
87
|
+
--image-family=ubuntu-2204-lts \
|
|
88
|
+
--image-project=ubuntu-os-cloud \
|
|
89
|
+
--boot-disk-size=50GB \
|
|
90
|
+
--metadata-from-file=startup-script=startup.sh \
|
|
91
|
+
--service-account=app-sa@${PROJECT_ID}.iam.gserviceaccount.com \
|
|
92
|
+
--scopes=cloud-platform
|
|
93
|
+
|
|
94
|
+
# Instance with an additional data disk
|
|
95
|
+
gcloud compute instances create db-server \
|
|
96
|
+
--machine-type=n2-highmem-4 \
|
|
97
|
+
--zone=us-central1-a \
|
|
98
|
+
--image-family=debian-12 --image-project=debian-cloud \
|
|
99
|
+
--boot-disk-size=20GB \
|
|
100
|
+
--create-disk=name=data-disk,size=200GB,type=pd-ssd,auto-delete=no
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Startup Script Example
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
#!/bin/bash
|
|
107
|
+
# startup.sh - runs on first boot and every reboot
|
|
108
|
+
set -euo pipefail
|
|
109
|
+
apt-get update && apt-get install -y nginx
|
|
110
|
+
systemctl enable nginx && systemctl start nginx
|
|
111
|
+
curl -X PUT -H "Metadata-Flavor: Google" \
|
|
112
|
+
"http://metadata.google.internal/computeMetadata/v1/instance/guest-attributes/startup/status" \
|
|
113
|
+
-d "complete"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Instance Templates and Managed Instance Groups
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Create an instance template
|
|
120
|
+
gcloud compute instance-templates create web-template \
|
|
121
|
+
--machine-type=e2-medium \
|
|
122
|
+
--image-family=debian-12 --image-project=debian-cloud \
|
|
123
|
+
--boot-disk-size=20GB --tags=http-server \
|
|
124
|
+
--metadata-from-file=startup-script=startup.sh
|
|
125
|
+
|
|
126
|
+
# Create a regional managed instance group (MIG) with health check
|
|
127
|
+
gcloud compute health-checks create http http-health-check \
|
|
128
|
+
--port=80 --request-path=/healthz \
|
|
129
|
+
--check-interval=10s --timeout=5s \
|
|
130
|
+
--healthy-threshold=2 --unhealthy-threshold=3
|
|
131
|
+
|
|
132
|
+
gcloud compute instance-groups managed create web-mig \
|
|
133
|
+
--template=web-template --size=3 \
|
|
134
|
+
--region=us-central1 \
|
|
135
|
+
--health-check=http-health-check --initial-delay=120
|
|
136
|
+
|
|
137
|
+
# Configure autoscaling
|
|
138
|
+
gcloud compute instance-groups managed set-autoscaling web-mig \
|
|
139
|
+
--region=us-central1 \
|
|
140
|
+
--min-num-replicas=2 --max-num-replicas=10 \
|
|
141
|
+
--target-cpu-utilization=0.65 --cool-down-period=90
|
|
142
|
+
|
|
143
|
+
# Rolling update to a new template
|
|
144
|
+
gcloud compute instance-groups managed rolling-action start-update web-mig \
|
|
145
|
+
--version=template=web-template-v2 \
|
|
146
|
+
--region=us-central1 --max-surge=3 --max-unavailable=0
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Preemptible and Spot VMs
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Spot VM (recommended over legacy preemptible)
|
|
153
|
+
gcloud compute instances create spot-worker \
|
|
154
|
+
--machine-type=n2-standard-8 \
|
|
155
|
+
--zone=us-central1-a \
|
|
156
|
+
--image-family=debian-12 --image-project=debian-cloud \
|
|
157
|
+
--provisioning-model=SPOT \
|
|
158
|
+
--instance-termination-action=STOP
|
|
159
|
+
|
|
160
|
+
# Spot instance template for batch MIG
|
|
161
|
+
gcloud compute instance-templates create batch-template \
|
|
162
|
+
--machine-type=n2-standard-4 \
|
|
163
|
+
--image-family=debian-12 --image-project=debian-cloud \
|
|
164
|
+
--provisioning-model=SPOT \
|
|
165
|
+
--instance-termination-action=DELETE
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Snapshots and Images
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Create a snapshot
|
|
172
|
+
gcloud compute disks snapshot web-server \
|
|
173
|
+
--zone=us-central1-a \
|
|
174
|
+
--snapshot-names=web-server-snap-$(date +%Y%m%d)
|
|
175
|
+
|
|
176
|
+
# Scheduled snapshot policy
|
|
177
|
+
gcloud compute resource-policies create snapshot-schedule daily-backup \
|
|
178
|
+
--region=us-central1 --max-retention-days=14 \
|
|
179
|
+
--daily-schedule --start-time=03:00
|
|
180
|
+
|
|
181
|
+
gcloud compute disks add-resource-policies web-server \
|
|
182
|
+
--zone=us-central1-a --resource-policies=daily-backup
|
|
183
|
+
|
|
184
|
+
# Create a custom image from an instance
|
|
185
|
+
gcloud compute instances stop web-server --zone=us-central1-a
|
|
186
|
+
gcloud compute images create web-golden-image \
|
|
187
|
+
--source-disk=web-server --source-disk-zone=us-central1-a \
|
|
188
|
+
--family=web-server --labels=version=v1
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Terraform Configuration
|
|
192
|
+
|
|
193
|
+
```hcl
|
|
194
|
+
resource "google_compute_instance" "web" {
|
|
195
|
+
name = "web-server"
|
|
196
|
+
machine_type = "e2-medium"
|
|
197
|
+
zone = "us-central1-a"
|
|
198
|
+
tags = ["http-server", "https-server"]
|
|
199
|
+
|
|
200
|
+
boot_disk {
|
|
201
|
+
initialize_params {
|
|
202
|
+
image = "debian-cloud/debian-12"
|
|
203
|
+
size = 20
|
|
204
|
+
type = "pd-balanced"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
network_interface {
|
|
209
|
+
subnetwork = google_compute_subnetwork.main.id
|
|
210
|
+
access_config {}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
metadata_startup_script = file("${path.module}/startup.sh")
|
|
214
|
+
|
|
215
|
+
service_account {
|
|
216
|
+
email = google_service_account.app.email
|
|
217
|
+
scopes = ["cloud-platform"]
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
shielded_instance_config {
|
|
221
|
+
enable_secure_boot = true
|
|
222
|
+
enable_vtpm = true
|
|
223
|
+
enable_integrity_monitoring = true
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
resource "google_compute_instance_template" "web" {
|
|
228
|
+
name_prefix = "web-"
|
|
229
|
+
machine_type = "e2-medium"
|
|
230
|
+
|
|
231
|
+
disk {
|
|
232
|
+
source_image = "debian-cloud/debian-12"
|
|
233
|
+
auto_delete = true
|
|
234
|
+
boot = true
|
|
235
|
+
disk_size_gb = 20
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
network_interface {
|
|
239
|
+
subnetwork = google_compute_subnetwork.main.id
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
lifecycle { create_before_destroy = true }
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
resource "google_compute_region_instance_group_manager" "web" {
|
|
246
|
+
name = "web-mig"
|
|
247
|
+
base_instance_name = "web"
|
|
248
|
+
region = "us-central1"
|
|
249
|
+
|
|
250
|
+
version {
|
|
251
|
+
instance_template = google_compute_instance_template.web.id
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
target_size = 3
|
|
255
|
+
named_port { name = "http"; port = 80 }
|
|
256
|
+
|
|
257
|
+
auto_healing_policies {
|
|
258
|
+
health_check = google_compute_health_check.http.id
|
|
259
|
+
initial_delay_sec = 120
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
resource "google_compute_region_autoscaler" "web" {
|
|
264
|
+
name = "web-autoscaler"
|
|
265
|
+
region = "us-central1"
|
|
266
|
+
target = google_compute_region_instance_group_manager.web.id
|
|
267
|
+
|
|
268
|
+
autoscaling_policy {
|
|
269
|
+
min_replicas = 2
|
|
270
|
+
max_replicas = 10
|
|
271
|
+
cooldown_period = 90
|
|
272
|
+
cpu_utilization { target = 0.65 }
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Common Operations
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# SSH into an instance
|
|
281
|
+
gcloud compute ssh web-server --zone=us-central1-a
|
|
282
|
+
|
|
283
|
+
# List all instances with status
|
|
284
|
+
gcloud compute instances list \
|
|
285
|
+
--format="table(name,zone,status,machineType.basename())"
|
|
286
|
+
|
|
287
|
+
# Stop / start / resize
|
|
288
|
+
gcloud compute instances stop web-server --zone=us-central1-a
|
|
289
|
+
gcloud compute instances set-machine-type web-server \
|
|
290
|
+
--machine-type=e2-standard-4 --zone=us-central1-a
|
|
291
|
+
gcloud compute instances start web-server --zone=us-central1-a
|
|
292
|
+
|
|
293
|
+
# View serial port output (debug startup scripts)
|
|
294
|
+
gcloud compute instances get-serial-port-output web-server --zone=us-central1-a
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Troubleshooting
|
|
298
|
+
|
|
299
|
+
| Symptom | Cause | Fix |
|
|
300
|
+
|---------|-------|-----|
|
|
301
|
+
| Instance stuck in STAGING | Quota exceeded or resource unavailable | Check quota with `gcloud compute project-info describe`; try another zone |
|
|
302
|
+
| Startup script not running | Syntax errors or wrong metadata key | Check serial output; ensure key is `startup-script` not `startup_script` |
|
|
303
|
+
| Cannot SSH | Firewall blocks port 22 or OS Login misconfigured | Add firewall rule for `tcp:22`; verify `enable-oslogin` metadata |
|
|
304
|
+
| Preempted too often | Zone resource pressure | Use Spot VM with `STOP` action; spread across zones in a MIG |
|
|
305
|
+
| Disk out of space | Boot disk too small | Use `gcloud compute disks resize`; enable `--storage-auto-increase` for data disks |
|
|
306
|
+
| MIG not healing | Health check misconfigured or initial delay too short | Verify health check path returns 200; increase `--initial-delay` |
|
|
307
|
+
|
|
308
|
+
## Related Skills
|
|
309
|
+
|
|
310
|
+
- **gcp-networking** - VPC, firewall rules, and load balancers for Compute Engine
|
|
311
|
+
- **terraform-gcp** - Provision Compute Engine resources with Infrastructure as Code
|
|
312
|
+
- **gcp-gke** - When workloads are better suited for containers than VMs
|
|
313
|
+
- **gcp-cloud-sql** - Managed databases that Compute Engine applications connect to
|
|
314
|
+
|
|
315
|
+
## Limitations
|
|
316
|
+
|
|
317
|
+
- Infrastructure commands can disrupt services: confirm target host/scope and have backups/snapshots before mutating state.
|
|
318
|
+
- Docs-only import: upstream scripts and templates not bundled.
|
|
319
|
+
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gcp-gke
|
|
3
|
+
description: Deploy and manage Google Kubernetes Engine clusters. Configure node pools,
|
|
4
|
+
networking, and workload identity. Use when running Kubernetes on GCP.
|
|
5
|
+
category: devops
|
|
6
|
+
risk: critical
|
|
7
|
+
source: https://github.com/BagelHole/DevOps-Security-Agent-Skills
|
|
8
|
+
source_repo: BagelHole/DevOps-Security-Agent-Skills
|
|
9
|
+
source_type: community
|
|
10
|
+
date_added: '2026-09-20'
|
|
11
|
+
license: MIT
|
|
12
|
+
license_source: https://github.com/BagelHole/DevOps-Security-Agent-Skills/blob/main/LICENSE
|
|
13
|
+
compatibility: Requires the relevant OS/platform tooling and privileged access where
|
|
14
|
+
noted. Docs-only; helper scripts and templates not bundled.
|
|
15
|
+
metadata:
|
|
16
|
+
author: devops-skills
|
|
17
|
+
version: '1.0'
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Google Kubernetes Engine (GKE)
|
|
21
|
+
|
|
22
|
+
Deploy, operate, and scale managed Kubernetes clusters on Google Cloud Platform.
|
|
23
|
+
|
|
24
|
+
## When to Use
|
|
25
|
+
|
|
26
|
+
- Running containerized microservices at scale with automatic scaling and healing
|
|
27
|
+
- Workloads requiring fine-grained orchestration, service mesh, or custom scheduling
|
|
28
|
+
- Teams already invested in Kubernetes tooling (Helm, Argo CD, Flux)
|
|
29
|
+
- When Cloud Run's request-based model does not fit (long-running, stateful workloads)
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
- Google Cloud SDK (`gcloud`) and `kubectl` installed
|
|
34
|
+
- APIs enabled: Kubernetes Engine, Compute Engine
|
|
35
|
+
- IAM role `roles/container.admin` for cluster management
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gcloud services enable container.googleapis.com compute.googleapis.com
|
|
39
|
+
gcloud components install kubectl
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Standard vs Autopilot
|
|
43
|
+
|
|
44
|
+
| Feature | Standard | Autopilot |
|
|
45
|
+
|---------|----------|-----------|
|
|
46
|
+
| Node management | You manage node pools | Google manages nodes |
|
|
47
|
+
| Pricing | Pay per node (VM) | Pay per pod resource request |
|
|
48
|
+
| GPU/TPU | Full support | Supported (with limits) |
|
|
49
|
+
| DaemonSets | Allowed | Restricted |
|
|
50
|
+
| Best for | Full control, specialized HW | Hands-off, cost-optimized |
|
|
51
|
+
|
|
52
|
+
## Create a Standard Cluster
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
gcloud container clusters create prod-cluster \
|
|
56
|
+
--region=us-central1 --num-nodes=2 \
|
|
57
|
+
--machine-type=e2-standard-4 --disk-size=100 \
|
|
58
|
+
--enable-autoscaling --min-nodes=1 --max-nodes=5 \
|
|
59
|
+
--enable-autorepair --enable-autoupgrade \
|
|
60
|
+
--release-channel=regular \
|
|
61
|
+
--workload-pool=${PROJECT_ID}.svc.id.goog \
|
|
62
|
+
--enable-ip-alias --enable-network-policy \
|
|
63
|
+
--enable-shielded-nodes \
|
|
64
|
+
--logging=SYSTEM,WORKLOAD --monitoring=SYSTEM,WORKLOAD \
|
|
65
|
+
--labels=env=production,team=platform
|
|
66
|
+
|
|
67
|
+
gcloud container clusters get-credentials prod-cluster --region=us-central1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Create an Autopilot Cluster
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
gcloud container clusters create-auto autopilot-prod \
|
|
74
|
+
--region=us-central1 --release-channel=regular \
|
|
75
|
+
--workload-pool=${PROJECT_ID}.svc.id.goog \
|
|
76
|
+
--network=my-vpc --subnetwork=gke-subnet
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Node Pools
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# High-memory pool with taint
|
|
83
|
+
gcloud container node-pools create highmem-pool \
|
|
84
|
+
--cluster=prod-cluster --region=us-central1 \
|
|
85
|
+
--machine-type=n2-highmem-8 --disk-size=200 --disk-type=pd-ssd \
|
|
86
|
+
--num-nodes=1 --enable-autoscaling --min-nodes=0 --max-nodes=4 \
|
|
87
|
+
--node-labels=workload=memory-intensive \
|
|
88
|
+
--node-taints=dedicated=highmem:NoSchedule
|
|
89
|
+
|
|
90
|
+
# GPU pool
|
|
91
|
+
gcloud container node-pools create gpu-pool \
|
|
92
|
+
--cluster=prod-cluster --region=us-central1 \
|
|
93
|
+
--machine-type=n1-standard-8 \
|
|
94
|
+
--accelerator=type=nvidia-tesla-t4,count=1 \
|
|
95
|
+
--num-nodes=0 --enable-autoscaling --min-nodes=0 --max-nodes=4 \
|
|
96
|
+
--node-taints=nvidia.com/gpu=present:NoSchedule
|
|
97
|
+
|
|
98
|
+
# Spot pool for batch workloads
|
|
99
|
+
gcloud container node-pools create spot-pool \
|
|
100
|
+
--cluster=prod-cluster --region=us-central1 \
|
|
101
|
+
--machine-type=e2-standard-4 --spot \
|
|
102
|
+
--num-nodes=0 --enable-autoscaling --min-nodes=0 --max-nodes=20 \
|
|
103
|
+
--node-taints=cloud.google.com/gke-spot=true:NoSchedule
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Workload Identity
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Create GSA and grant permissions
|
|
110
|
+
gcloud iam service-accounts create app-gsa
|
|
111
|
+
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
|
|
112
|
+
--member="serviceAccount:app-gsa@${PROJECT_ID}.iam.gserviceaccount.com" \
|
|
113
|
+
--role="roles/storage.objectViewer"
|
|
114
|
+
|
|
115
|
+
# Create KSA and bind to GSA
|
|
116
|
+
kubectl create namespace myapp
|
|
117
|
+
kubectl create serviceaccount app-ksa --namespace=myapp
|
|
118
|
+
gcloud iam service-accounts add-iam-policy-binding \
|
|
119
|
+
app-gsa@${PROJECT_ID}.iam.gserviceaccount.com \
|
|
120
|
+
--role=roles/iam.workloadIdentityUser \
|
|
121
|
+
--member="serviceAccount:${PROJECT_ID}.svc.id.goog[myapp/app-ksa]"
|
|
122
|
+
kubectl annotate serviceaccount app-ksa --namespace=myapp \
|
|
123
|
+
iam.gke.io/gcp-service-account=app-gsa@${PROJECT_ID}.iam.gserviceaccount.com
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Deploying Workloads
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
# deployment.yaml
|
|
130
|
+
apiVersion: apps/v1
|
|
131
|
+
kind: Deployment
|
|
132
|
+
metadata:
|
|
133
|
+
name: web-app
|
|
134
|
+
namespace: myapp
|
|
135
|
+
spec:
|
|
136
|
+
replicas: 3
|
|
137
|
+
selector:
|
|
138
|
+
matchLabels: { app: web-app }
|
|
139
|
+
template:
|
|
140
|
+
metadata:
|
|
141
|
+
labels: { app: web-app }
|
|
142
|
+
spec:
|
|
143
|
+
serviceAccountName: app-ksa
|
|
144
|
+
containers:
|
|
145
|
+
- name: web
|
|
146
|
+
image: us-central1-docker.pkg.dev/PROJECT_ID/repo/web-app:v1.2.0
|
|
147
|
+
ports: [{ containerPort: 8080 }]
|
|
148
|
+
resources:
|
|
149
|
+
requests: { cpu: 250m, memory: 512Mi }
|
|
150
|
+
limits: { cpu: 500m, memory: 1Gi }
|
|
151
|
+
readinessProbe:
|
|
152
|
+
httpGet: { path: /healthz, port: 8080 }
|
|
153
|
+
initialDelaySeconds: 5
|
|
154
|
+
livenessProbe:
|
|
155
|
+
httpGet: { path: /healthz, port: 8080 }
|
|
156
|
+
initialDelaySeconds: 15
|
|
157
|
+
topologySpreadConstraints:
|
|
158
|
+
- maxSkew: 1
|
|
159
|
+
topologyKey: topology.kubernetes.io/zone
|
|
160
|
+
whenUnsatisfiable: DoNotSchedule
|
|
161
|
+
labelSelector:
|
|
162
|
+
matchLabels: { app: web-app }
|
|
163
|
+
---
|
|
164
|
+
apiVersion: v1
|
|
165
|
+
kind: Service
|
|
166
|
+
metadata: { name: web-app, namespace: myapp }
|
|
167
|
+
spec:
|
|
168
|
+
selector: { app: web-app }
|
|
169
|
+
ports: [{ port: 80, targetPort: 8080 }]
|
|
170
|
+
type: ClusterIP
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Ingress with Managed SSL
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
apiVersion: networking.k8s.io/v1
|
|
177
|
+
kind: Ingress
|
|
178
|
+
metadata:
|
|
179
|
+
name: web-ingress
|
|
180
|
+
namespace: myapp
|
|
181
|
+
annotations:
|
|
182
|
+
kubernetes.io/ingress.class: "gce"
|
|
183
|
+
networking.gke.io/managed-certificates: "web-cert"
|
|
184
|
+
kubernetes.io/ingress.global-static-ip-name: "web-static-ip"
|
|
185
|
+
spec:
|
|
186
|
+
rules:
|
|
187
|
+
- host: app.example.com
|
|
188
|
+
http:
|
|
189
|
+
paths:
|
|
190
|
+
- path: /
|
|
191
|
+
pathType: Prefix
|
|
192
|
+
backend:
|
|
193
|
+
service: { name: web-app, port: { number: 80 } }
|
|
194
|
+
---
|
|
195
|
+
apiVersion: networking.gke.io/v1
|
|
196
|
+
kind: ManagedCertificate
|
|
197
|
+
metadata: { name: web-cert, namespace: myapp }
|
|
198
|
+
spec:
|
|
199
|
+
domains: [app.example.com]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
gcloud compute addresses create web-static-ip --global
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Terraform Configuration
|
|
207
|
+
|
|
208
|
+
```hcl
|
|
209
|
+
resource "google_container_cluster" "primary" {
|
|
210
|
+
name = "prod-cluster"
|
|
211
|
+
location = "us-central1"
|
|
212
|
+
|
|
213
|
+
release_channel { channel = "REGULAR" }
|
|
214
|
+
workload_identity_config { workload_pool = "${var.project_id}.svc.id.goog" }
|
|
215
|
+
|
|
216
|
+
network = google_compute_network.vpc.name
|
|
217
|
+
subnetwork = google_compute_subnetwork.gke.name
|
|
218
|
+
|
|
219
|
+
ip_allocation_policy {
|
|
220
|
+
cluster_secondary_range_name = "pods"
|
|
221
|
+
services_secondary_range_name = "services"
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private_cluster_config {
|
|
225
|
+
enable_private_nodes = true
|
|
226
|
+
master_ipv4_cidr_block = "172.16.0.0/28"
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
network_policy { enabled = true }
|
|
230
|
+
logging_config { enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"] }
|
|
231
|
+
monitoring_config {
|
|
232
|
+
enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"]
|
|
233
|
+
managed_prometheus { enabled = true }
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
remove_default_node_pool = true
|
|
237
|
+
initial_node_count = 1
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
resource "google_container_node_pool" "primary" {
|
|
241
|
+
name = "primary-pool"
|
|
242
|
+
cluster = google_container_cluster.primary.name
|
|
243
|
+
location = "us-central1"
|
|
244
|
+
|
|
245
|
+
initial_node_count = 2
|
|
246
|
+
autoscaling { min_node_count = 1; max_node_count = 5 }
|
|
247
|
+
management { auto_repair = true; auto_upgrade = true }
|
|
248
|
+
|
|
249
|
+
node_config {
|
|
250
|
+
machine_type = "e2-standard-4"
|
|
251
|
+
disk_size_gb = 100
|
|
252
|
+
disk_type = "pd-balanced"
|
|
253
|
+
oauth_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
|
|
254
|
+
shielded_instance_config {
|
|
255
|
+
enable_secure_boot = true
|
|
256
|
+
enable_integrity_monitoring = true
|
|
257
|
+
}
|
|
258
|
+
metadata = { disable-legacy-endpoints = "true" }
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
resource "google_compute_subnetwork" "gke" {
|
|
263
|
+
name = "gke-subnet"
|
|
264
|
+
ip_cidr_range = "10.0.0.0/20"
|
|
265
|
+
region = "us-central1"
|
|
266
|
+
network = google_compute_network.vpc.id
|
|
267
|
+
|
|
268
|
+
secondary_ip_range { range_name = "pods"; ip_cidr_range = "10.4.0.0/14" }
|
|
269
|
+
secondary_ip_range { range_name = "services"; ip_cidr_range = "10.8.0.0/20" }
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Common Operations
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
gcloud container clusters list
|
|
277
|
+
gcloud container clusters upgrade prod-cluster --region=us-central1 --master
|
|
278
|
+
kubectl top nodes && kubectl top pods --namespace=myapp
|
|
279
|
+
kubectl scale deployment web-app --replicas=5 --namespace=myapp
|
|
280
|
+
kubectl autoscale deployment web-app --namespace=myapp --min=3 --max=20 --cpu-percent=70
|
|
281
|
+
kubectl logs -f deployment/web-app --namespace=myapp --all-containers
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Troubleshooting
|
|
285
|
+
|
|
286
|
+
| Symptom | Cause | Fix |
|
|
287
|
+
|---------|-------|-----|
|
|
288
|
+
| Pods stuck in `Pending` | No nodes with enough resources | Check autoscaler; add larger node pool; verify resource requests |
|
|
289
|
+
| `ImagePullBackOff` | Wrong image path or missing AR access | Verify image URL; grant `roles/artifactregistry.reader` to node SA |
|
|
290
|
+
| Workload Identity wrong account | KSA annotation missing | Re-annotate KSA; restart pods to pick up new token |
|
|
291
|
+
| Nodes `NotReady` | Disk/memory pressure or network issue | Run `kubectl describe node`; check taints and conditions |
|
|
292
|
+
| Ingress returns 502 | Backend pods failing health check | Verify readiness probe; check NEG health in Console |
|
|
293
|
+
| Cluster create quota error | Insufficient regional CPU/IP quota | Request quota increase in IAM & Admin > Quotas |
|
|
294
|
+
| Network policy not working | Not enabled on cluster | Recreate with `--enable-network-policy` or use Dataplane V2 |
|
|
295
|
+
|
|
296
|
+
## Related Skills
|
|
297
|
+
|
|
298
|
+
- **gcp-networking** - VPC, firewall rules, and load balancers for GKE clusters
|
|
299
|
+
- **terraform-gcp** - Provision GKE clusters with Infrastructure as Code
|
|
300
|
+
- **gcp-compute** - When workloads are better suited for VMs than containers
|
|
301
|
+
- **gcp-cloud-sql** - Connecting GKE pods to Cloud SQL via sidecar proxy
|
|
302
|
+
|
|
303
|
+
## Limitations
|
|
304
|
+
|
|
305
|
+
- Infrastructure commands can disrupt services: confirm target host/scope and have backups/snapshots before mutating state.
|
|
306
|
+
- Docs-only import: upstream scripts and templates not bundled.
|
|
307
|
+
|