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?
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
Q01Your company is migrating to Google Cloud and needs to establish a resource hierarchy. You have t...EasyQ02You are managing access to a GCP project. You need to grant 15 developers the ability to view Com...MediumQ03You have created a new GCP project using the Cloud Console. You want to deploy a Cloud Function u...EasyQ04Your startup has a strict monthly cloud budget of $500. You want to be notified immediately if yo...EasyQ05Your finance team wants to perform complex SQL analysis on your GCP billing data to understand co...Medium
Expert