0
0
GCPcloud~10 mins

Deploying workloads in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to deploy a container image to Cloud Run.

GCP
gcloud run deploy my-service --image [1] --region us-central1
Drag options to blanks, or click blank then click option'
Acloudrun deploy
Bgcr.io/my-project/my-image:latest
Cdocker run my-image
Dmy-image
Attempts:
3 left
💡 Hint
Common Mistakes
Using just the image name without registry and project
Trying to run docker commands instead of specifying image
Using incorrect flags for deployment
2fill in blank
medium

Complete the command to create a Kubernetes deployment with 3 replicas.

GCP
kubectl create deployment my-app --image=my-app-image --replicas=[1]
Drag options to blanks, or click blank then click option'
A1
B0
C5
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replicas to 0 which means no pods run
Using default 1 when multiple pods are needed
3fill in blank
hard

Fix the error in the YAML snippet to expose a Kubernetes deployment as a LoadBalancer service.

GCP
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: [1]
  selector:
    app: my-app
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
Drag options to blanks, or click blank then click option'
AExternalName
BNodePort
CLoadBalancer
DClusterIP
Attempts:
3 left
💡 Hint
Common Mistakes
Using ClusterIP which is internal only
Using NodePort which exposes on node ports but not a cloud load balancer
4fill in blank
hard

Fill both blanks to define a Cloud Build trigger that runs on pushes to the main branch.

GCP
trigger:
  name: my-trigger
  github:
    owner: my-org
    name: my-repo
  triggerTemplate:
    branchName: [1]
    projectId: [2]
Drag options to blanks, or click blank then click option'
Amain
Bdevelop
Cmy-gcp-project
Dtest-project
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong branch name like 'develop'
Using an incorrect or placeholder project ID
5fill in blank
hard

Fill all three blanks to create a Terraform resource for a Google Compute Engine VM instance.

GCP
resource "google_compute_instance" "vm_instance" {
  name         = [1]
  machine_type = [2]
  zone         = [3]

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
    }
  }

  network_interface {
    network = "default"
    access_config {}
  }
}
Drag options to blanks, or click blank then click option'
A"my-vm-instance"
B"e2-medium"
C"us-central1-a"
D"n1-standard-1"
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around strings
Using invalid machine types or zones