Deploying a Kubernetes App on a New GKE Cluster

Configuring compute systems. Interacting with Google Cloud programmatically.

The development team has provided you with a Kubernetes Deployment file. You have no infrastructure yet and need to deploy the application. What should you do?

  1. Use gcloud to create a Kubernetes cluster. Use Deployment Manager to create the deployment.
  2. Use gcloud to create a Kubernetes cluster. Use kubectl to create the deployment. Correct Answer
  3. Use kubectl to create a Kubernetes cluster. Use Deployment Manager to create the deployment.
  4. Use kubectl to create a Kubernetes cluster. Use kubectl to create the deployment.
Answer Correct answer: B — Create the GKE cluster with gcloud container clusters create, then apply the Deployment file with kubectl apply -f.

Community Insight

The test measures whether you know which tool provisions GKE infrastructure versus which tool drives an existing cluster; the trap is assuming Deployment Manager can apply a Kubernetes Deployment YAML, which it cannot.

When no infrastructure exists and a Kubernetes Deployment file is provided, the cluster must be provisioned first with the Google Cloud CLI (gcloud container clusters create) and the workload applied afterwards with kubectl. This question tests the correct division of labor between gcloud (GKE infrastructure provisioning) and kubectl (cluster workload management), and confirms that answer B is the standard workflow.

Option A is the most tempting wrong answer: learners reason that because we have a Deployment file, Deployment Manager should handle it. Deployment Manager provisions Google Cloud infrastructure templates, not Kubernetes resources inside a cluster — applying a Deployment manifest requires kubectl (or the GKE API via kubectl-compatible tooling).

Community Discussion (82 comments)

Raquel_pr03 👍 1 Selected: B
Answer is B
simiramis221 👍 1
Answer is B %100
vamgcp 👍 4
Create a Google Kubernetes Engine (GKE) cluster: You can use the Google Cloud Console or the gcloud command-line tool to create a GKE cluster, which will provide the underlying infrastructure for running your application. Deploy the application to the cluster: You can use the kubectl command-line tool to apply the Kubernetes Deployment file provided by the development team to the cluster.kubectl apply -f deployment.yaml
megumin 👍 1 Selected: B
B is ok
Mahmoud_E 👍 1 Selected: B
is the correct answer https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster
Mahmoud_E 👍 1
B is the correct answer cluster https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster
AzureDP900 👍 1
B is right
SAMBIT 👍 2
Kubctle comes live only when cluster has been created in the cloud console using cloud command
ghadxx 👍 9 Selected: B
Deployment Manager is used to automate the process of provisioning infrastructure. Therefore, gcloud and Deployment Manager do the same thing. Meanwhile, kubectl is used to run commands against an already created cluster.
haroldbenites 👍 2
Go for B. gcloud for create clusters. kubectl is used when the cluster already has been created. For example to create deployments. Kubectl has configured a config file where is specified the default cluster.
vincy2202 👍 1
B is correct
Zinhle 👍 1
Hi all may someone please share the link for the bank of questions because I cannot seem to locate them. thank you
MaxNRG 👍 2
B – use gcloud to create cluster, use kubectl to create a deployment. https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-zonal-cluster In fact, kubectl run creates a deployment. https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app
ale183 👍 3
Question for all , do we know if only new questions are part of the bank for new exam? Have any of the old questions appeared on new exam?
xaliq 👍 1
B is corrent
Raja101 👍 3
Why not A ?
MamthaSJ 👍 2
Answer is B
kopper2019 👍 1
hey guys check Q3 for new Qs
aviratna 👍 1
B is correct. 1st create GKE cluster using gcloud command and then use kubectl command for application deployment using deployment
certificationjjmmm 👍 1
No doubt about it is "B"
victory108 👍 2
B. Use gcloud to create a Kubernetes cluster. Use kubectl to create the deployment.
un 👍 1
B is correct
getAlok 👍 2
B Create kubernaes cluster - gcloud container clusters create my-cluster --zone Do deployment - kubectl apply -f file name
pentium2000 👍 5
B Step 1: gcloud container clusters create my-cluster --zone us-central1-a Step 2: kubectl apply -f file.yml
Ausias18 👍 1
Answer is B
lynx256 👍 4
Why we cannot use Deployment Manager (instead of kubectl) to create the deployment (opt. A)? We have the Deployment file, so why we cannot use it with Deployment Manager ?
Kiroo 👍 1
Kubeclt to create a cluster ? Nope this is just not right , kubeclt is to manage the cluster after is was created
VenV 👍 1
B should be correct
ahmedemad3 👍 1
Ans: B gcloud create the Ku8 clusters and kubectl for deployment https://cloud.google.com/kubernetes-engine/docs/quickstart
sindra 👍 1
agreed with B
Prakzz 👍 1
B is correct
varushar 👍 1
Essentially, gcloud gives you the ability to provision and deprovision resources, whereas kubectl gives you the ability to use the clusters once provisioned. Answer must be B, IMO
hyz1991 👍 2
I just curious who put an "official" solution over here? It has zero correct guarantee
AdityaGupta 👍 1
Correct Answer is B, gcloud is used to create kubernets cluster and kubectl commnds are used to create container deployments.
AshokC 👍 1
B - 1 - Create cluster with glcoud console 2 - Use kubectl for the deploy
WannaBeCloudArch 👍 1
Answer is B : gloud command to create cluster and kubectl command to deploy
Kabiliravi 👍 2
B is correct
dayody 👍 1
B is the correct answer
vmrandy 👍 1
I believe B is correct.
Khalnaik 👍 2
Definitely B
wiqi 👍 2
B is correct. Since you have Kubernetes deployment file. You need to deploy the cluster using: gcloud container clusters create gke-cluster-1 --num-nodes=2 Once the cluster is up. You simply apply the deployment file using: kubectl apply -f <deployment-file.yaml>
haidertanveer0808 👍 1
Will go with B
elnagmy 👍 1
B is the correct
theWildOne 👍 1
kubectl is used for deployments, not for creating k8s clusters, it´s B!
RM07 👍 1
Correct Ans is B.please refer: https://cloud.google.com/kubernetes-engine/docs/quickstart
RM07 👍 1
Ans is B.please refer: https://cloud.google.com/kubernetes-engine/docs/quickstart
Gobblegobble 👍 1
B is right answer
tartar 👍 9
B is ok
mlantonis 👍 1
It should be B
Technology 👍 1
B is the right answer
akhilesh_pundir 👍 2
No the correct answer is B. Gcloud is used to create kubernetes cluster. https://cloud.google.com/sdk/gcloud/reference/container/clusters/create Sample for deployment creation: kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
kban 👍 1
B is correct answer
Tushant 👍 1
B is the right answer
Ziegler 👍 1
B is the correct answer.
Nirms 👍 1
B is correct answer
AD2AD4 👍 1
Final Decision to go with Option B
Javed 👍 1
B correct
gcp_aws 👍 1
B is correct
laksg 👍 1
B is the right answer.
Jack_in_Large 👍 1
You only have one choice B or SB :)
GunjGupta 👍 1
I will go with B as Cluster creation is managed by GKE(using gcloud ) and deployment in POd manged by kubectl.
asure 👍 1
B is 100% correct
Zarmi 👍 1
Answer B
Googler2 👍 1
Answer B - Why this website is suggesting answer like A ? we know container clusters can only be created with gcloud. kubectl is for deployments.
Googler2 👍 1
sorry I meant why the website suggest answer C? the answer is B
anton_royce 👍 1
Answer B, I just created on my GCP
toyochik 👍 1
Obviously B. Create a gke cluster using gcloud then deploy pods using kubectl create(or apply) -f manifest.yml
rickywck 👍 1
Definitely B
ADVIT 👍 1
Only B
2g 👍 1
Answer: B
natpilot 👍 1
B is better
sri007 👍 1
B is ans
passnow 👍 6
I would go with B even in my sleep. . Use gcloud to create a Kubernetes cluster. Use kubectl to create the deployment.
GtanNar 👍 9
B is right: 1 - Create cluster with glcoud console 2 - Use kubectl for the deploy Check this: gcloud container clusters create webfrontend --zone us-central1-a --num-nodes 2 kubectl run nginx --image=nginx:1.10.0 kubectl expose deployment nginx --port 80 --type LoadBalancer
pnearn 👍 6
Definitely B
shark 👍 4
i think B
Eroc 👍 2
Further documentation on gcloud for cluster creation (https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster)
MeasService 👍 54
It has to be B. gcloud for creating cluster and kubectl for creating deployment
KouShikyou 👍 26
May I ask why C is correct? I thought B was correct.
nitinz 👍 2
B, gcloud to manage GKE and to manage pods use kubctl.
kumarp6 👍 4
B is correct, when you create a nodes in GKE you use gcloud rather than kubectl...
res3 👍 4
yeap, gcloud command to create K8s cluster https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option B matches the canonical GKE workflow. Because there is no infrastructure yet, the cluster must be created first, and the supported CLI for that is gcloud container clusters create <name> --zone <zone>, which provisions a managed control plane and node pools. Once the cluster exists and credentials are fetched, kubectl apply -f deployment.yaml (or kubectl create -f) submits the development team's Deployment manifest to the Kubernetes API server, exactly the mechanism the file was written for. Community members spell this out with real commands, e.g. "gcloud container clusters create my-cluster --zone us-central1-a" followed by "kubectl apply -f file.yml". This two-tool split is the officially documented deployment path for GKE.

Why the Other Options Are Wrong

Option C and D are invalid because kubectl cannot create a GKE cluster: kubectl is a Kubernetes API client and only works once a cluster and an API endpoint already exist, so "Use kubectl to create a Kubernetes cluster" is impossible in this scenario. Option A uses the correct cluster-creation step but then points to Deployment Manager for the application deployment; Deployment Manager provisions Google Cloud resources from configuration templates (VMs, disks, networks), it does not apply Kubernetes workload manifests to a cluster. As one commenter noted, "Deployment Manager is used to automate the process of provisioning infrastructure," which overlaps with gcloud and still leaves kubectl as the only correct tool for the Deployment file. There is no option that mixes both tools correctly other than B.

Community Comment Notes

The community is overwhelmingly and correctly aligned on B, with MeasService stating plainly "It has to be B. gcloud for creating cluster and kubectl for deploying." KouShikyou's question "May I ask why C is correct? I thought B was correct" reflects confusion worth addressing: C is wrong because kubectl cannot provision a GKE cluster. lynx256 asks why Deployment Manager cannot be used instead of kubectl in option A, and ghadxx's reply resolves it — Deployment Manager automates provisioning of infrastructure, not in-cluster Kubernetes objects. Multiple commenters supply working command sequences (gadxx's two-step, GtanNar's create/run/expose pipeline) that independently confirm B.

Official Reference

Exam Strategy

When a question gives you no existing infrastructure, always look for the option that provisions the managed service with gcloud first, then performs the Kubernetes-specific action with kubectl. Eliminate any option where kubectl is asked to create a cluster — it is a client tool, not a provisioner.

Frequently Asked Questions

Why can't Deployment Manager apply the Kubernetes Deployment file (option A)?

Deployment Manager provisions Google Cloud infrastructure from templates (VMs, networks, disks); it does not create Kubernetes workload objects. A Deployment manifest must be submitted through kubectl against a running cluster's API server.

Why is 'Use kubectl to create a Kubernetes cluster' wrong in options C and D?

kubectl is a client for an existing Kubernetes API endpoint, so it cannot provision a GKE cluster. Creating a cluster on Google Cloud is done with gcloud container clusters create, the Console, or Terraform.

More PCA FAQ →

Related Analysis

Practice All PCA Questions

Access 81 questions with complete answers and detailed explanations.

View Full PCA Practice Test →

← Back to PCA Study Guide