Medium1 markMultiple Choice

GCP ACE · Question 23 · Domain 3.2: Deploying and implementing GKE resources

You have a running GKE cluster and you have authenticated your local kubectl tool to it. You want to deploy a containerized application using an image named 'gcr.io/my-project/my-app:v1' and ensure 3 replicas are running.

Which command is the simplest way to achieve this imperatively?

Answer options:

A.

kubectl run my-app --image=gcr.io/my-project/my-app:v1 --replicas=3

B.

gcloud container deploy my-app --image=gcr.io/my-project/my-app:v1

C.

kubectl create deployment my-app --image=gcr.io/my-project/my-app:v1 --replicas=3

D.

kubectl apply -f gcr.io/my-project/my-app:v1

How to approach this question

Distinguish between gcloud (infrastructure) and kubectl (Kubernetes resources), and know the modern imperative command for deployments.

Full Answer

C.kubectl create deployment my-app --image=gcr.io/my-project/my-app:v1 --replicas=3✓ Correct
kubectl create deployment my-app --image=gcr.io/my-project/my-app:v1 --replicas=3
To deploy applications inside a Kubernetes cluster, you use `kubectl`. The `kubectl create deployment` command is the standard imperative way to create a Deployment resource, which manages ReplicaSets and Pods. You can specify the image and number of replicas directly in the command.

Common mistakes

Using `kubectl run`, which used to create deployments in older versions but now only creates a single, unmanaged Pod.

Practice the full GCP Associate Cloud Engineer Practice Exam 2

50 questions · hints · full answers · grading

More questions from this exam