Skip to main content

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

ServiceDescriptionEquivalent
Cloud Source ReposPrivate Git repositoriesGitHub, GitLab
Cloud BuildServerless CI/CDJenkins, GitHub Actions
Artifact RegistryPackage & container registryDocker Hub, Nexus
Cloud DeployContinuous deliveryArgoCD, Spinnaker
GKEManaged KubernetesEKS, AKS
Cloud RunServerless containersAWS 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

UsagePrice
120 minutes/dayFree
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

UsagePrice
Storage$0.10/GB/month
EgressStandard GCP pricing
Vulnerability scanning$0.26/image

4.3 Cloud Run

ResourcePrice
vCPU$0.00002400/vCPU-second
Memory$0.00000250/GiB-second
Requests$0.40/million
Free tier2M requests/month

4.4 GKE

TypePrice
GKE Autopilot$0.10/vCPU/hour
GKE StandardFree (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

RegionLocation
europe-west1Belgium
europe-west2London
europe-west3Frankfurt
europe-west4Netherlands
europe-west9Paris

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

FeatureGCPAWSAzure
CI/CDCloud BuildCodePipelineAzure Pipelines
Container RegistryArtifact RegistryECRACR
KubernetesGKEEKSAKS
Serverless ContainersCloud RunFargateContainer Apps
MonitoringCloud MonitoringCloudWatchAzure 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


← Back to table of contents