300-910 · Question #110
An application is developed based on microservices. The application must be installed on a pod in a separate cluster. Which command must be used to deploy the application?
The correct answer is C. kubectl run kubernetes-deployment\ --image=gcr.io/kubertfetes-deployment:v1 \ --port=8080. To deploy an application as a pod or deployment directly from a container image in Kubernetes, the kubectl run command with the image and port specifications is used.
Question
Exhibit
Options
- Akubectl get nodes
- Bkubectl run deployments
- Ckubectl run kubernetes-deployment
--image=gcr.io/kubertfetes-deployment:v1
--port=8080 - Dkubectl version
How the community answered
(28 responses)- A4% (1)
- C93% (26)
- D4% (1)
Why each option
To deploy an application as a pod or deployment directly from a container image in Kubernetes, the `kubectl run` command with the image and port specifications is used.
`kubectl get nodes` is used to list the nodes in the cluster and their status, not to deploy an application.
`kubectl run deployments` is an incomplete and incorrect command; `deployments` is a resource type, but `kubectl run` requires an image and a name to create an instance.
The `kubectl run` command is used to create and run a specific container or deployment in a Kubernetes cluster. The provided command `kubectl run kubernetes-deployment --image=gcr.io/kubertfetes-deployment:v1 --port=8080` instructs Kubernetes to create a deployment named `kubernetes-deployment`, using the specified Docker image and exposing port 8080, which directly deploys the application as a pod (or set of pods via a Deployment object).
`kubectl version` displays the client and server versions of Kubernetes, which is for informational purposes, not for deploying applications.
Concept tested: Kubernetes deploying applications with kubectl run
Source: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run
Topics
Community Discussion
No community discussion yet for this question.
