Kubernetes Fundamentals
medium

Questão de Kubernetes Fundamentals #019e3a4f

Enunciado da Questão
Kubernetes Fundamentals
#kubernetes
#kubectl
#manifest
#deployment
Médio

How do you deploy a workload to Kubernetes without additional tools?

A

Create a Bash script and run it on a worker node.

B

Create a Helm Chart and install it with helm.

C

Create a manifest and apply it with kubectl.

Correta
D

Create a Python script and run it with kubectl.

Explicação Oficial / Explicações da Comunidade

The correct approach to deploy a workload to Kubernetes without additional tools is to create a manifest file (typically YAML or JSON) and apply it using kubectl apply. This is the native, built-in method provided by Kubernetes itself, requiring no extra software or scripts.

How it Works

Kubernetes uses declarative configuration. You define the desired state of your workload in a manifest file (e.g., a Deployment, Pod, or Service YAML). The kubectl apply command sends this manifest to the Kubernetes API server, which then creates or updates the resources to match the desired state. This is the standard, tool-free way to interact with a cluster.

Why the Correct Answer is Right

  • Creating a manifest and applying it with kubectl is the fundamental, built-in deployment method. kubectl is the official command-line tool for Kubernetes, and apply is the command to create or update resources from a manifest. No additional tools like Helm or custom scripts are needed.

Why the Incorrect Answers are Wrong

  • Creating a Bash script and running it on a worker node is not a Kubernetes-native approach. It bypasses the API server and scheduler, leading to lack of management, scaling, and self-healing. It also requires direct access to worker nodes, which is not standard practice.
  • Creating a Helm Chart and installing it with helm requires Helm, a package manager for Kubernetes. While Helm simplifies deployments, it is an additional tool, not part of the core Kubernetes distribution. The question specifies "without additional tools."
  • Creating a Python script and running it with kubectl is unnecessary and indirect. kubectl already provides all needed functionality; wrapping it in Python adds complexity without benefit. Moreover, running a Python script with kubectl is not a standard deployment method.