Questão de Kubernetes Fundamentals #019e3a4f
How do you deploy a workload to Kubernetes without additional tools?
Create a Bash script and run it on a worker node.
Create a Helm Chart and install it with helm.
Create a manifest and apply it with kubectl.
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
kubectlis the fundamental, built-in deployment method.kubectlis the official command-line tool for Kubernetes, andapplyis 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
helmrequires 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
kubectlis unnecessary and indirect.kubectlalready provides all needed functionality; wrapping it in Python adds complexity without benefit. Moreover, running a Python script withkubectlis not a standard deployment method.