Introduction to GCP DevOps
1 - GCP DevOps Ecosystem
Google Cloud Platform offers a complete suite of tools for developing, deploying, and operating applications.
2 - Main services
2.1 Overview
| Service | Description | Equivalent |
|---|---|---|
| Cloud Source Repos | Private Git repositories | GitHub, GitLab |
| Cloud Build | Serverless CI/CD | Jenkins, GitHub Actions |
| Artifact Registry | Package & container registry | Docker Hub, Nexus |
| Cloud Deploy | Continuous delivery | ArgoCD, Spinnaker |
| GKE | Managed Kubernetes | EKS, AKS |
| Cloud Run | Serverless containers | AWS Fargate |
2.2 Reference architecture
3 - Initial setup
3.1 Install gcloud CLI
# macOS
brew install google-cloud-sdk
# Linux
curl https://sdk.cloud.google.com | bash
# Windows
# Download from https://cloud.google.com/sdk/docs/install
# Initialize
gcloud init
# Log in
gcloud auth login
# Configure the project
gcloud config set project mon-projet-id
3.2 Enable APIs
# Enable DevOps APIs
gcloud services enable \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
cloudrun.googleapis.com \
container.googleapis.com \
clouddeploy.googleapis.com \
monitoring.googleapis.com \
logging.googleapis.com
3.3 IAM and permissions
# Create a Service Account
gcloud iam service-accounts create devops-sa \
--display-name="DevOps Service Account"
# Assign roles
gcloud projects add-iam-policy-binding mon-projet \
--member="serviceAccount:[email protected]" \
--role="roles/cloudbuild.builds.builder"
gcloud projects add-iam-policy-binding mon-projet \
--member="serviceAccount:[email protected]" \
--role="roles/artifactregistry.writer"
4 - Pricing
4.1 Cloud Build
| Usage | Price |
|---|---|
| 120 minutes/day | Free |
| Additional minutes | $0.003/min (e2-medium) |
| n1-highcpu-8 machine | $0.016/min |
| n1-highcpu-32 machine | $0.064/min |
4.2 Artifact Registry
| Usage | Price |
|---|---|
| Storage | $0.10/GB/month |
| Egress | Standard GCP pricing |
| Vulnerability scanning | $0.26/image |
4.3 Cloud Run
| Resource | Price |
|---|---|
| vCPU | $0.00002400/vCPU-second |
| Memory | $0.00000250/GiB-second |
| Requests | $0.40/million |
| Free tier | 2M requests/month |
4.4 GKE
| Type | Price |
|---|---|
| GKE Autopilot | $0.10/vCPU/hour |
| GKE Standard | Free (nodes billed) |
| Control plane | $0.10/hour/cluster |
5 - Organizations and projects
5.1 GCP hierarchy
5.2 Create a project
# Create a project
gcloud projects create mon-nouveau-projet \
--name="Mon Nouveau Projet" \
--organization=123456789
# Set as default project
gcloud config set project mon-nouveau-projet
# Link to a billing account
gcloud beta billing projects link mon-nouveau-projet \
--billing-account=0X0X0X-0X0X0X-0X0X0X
6 - Regions and zones
6.1 Europe regions
| Region | Location |
|---|---|
| europe-west1 | Belgium |
| europe-west2 | London |
| europe-west3 | Frankfurt |
| europe-west4 | Netherlands |
| europe-west9 | Paris |
6.2 Configuration
# Set the default region
gcloud config set compute/region europe-west1
gcloud config set compute/zone europe-west1-b
# Verify the configuration
gcloud config list
7 - Comparison with AWS and Azure
| Feature | GCP | AWS | Azure |
|---|---|---|---|
| CI/CD | Cloud Build | CodePipeline | Azure Pipelines |
| Container Registry | Artifact Registry | ECR | ACR |
| Kubernetes | GKE | EKS | AKS |
| Serverless Containers | Cloud Run | Fargate | Container Apps |
| Monitoring | Cloud Monitoring | CloudWatch | Azure Monitor |
Summary
In this chapter, we discovered:
- The GCP DevOps ecosystem
- The main services
- The initial setup (gcloud, APIs)
- Pricing
- Project organization
Next step
In the next chapter, we will explore Cloud Source Repositories.
→ Next chapter: Cloud Source Repositories