YAML Deployments
Kubernetes Cluster: YAML Deployments
.yaml or .yml file can describe one object or a complete list of related Kubernetes objects.
kubectl apply -f.
YAML Deployment Overview
A Kubernetes YAML file contains the declarative definition of one or more Kubernetes resources. The same type of definition can also be written in JSON, but YAML is the more common format in the Kubernetes community.
- A manifest can define a single Kubernetes object or multiple objects.
- The file can be applied directly without installing Helm or another package manager.
- The same manifest can be reused to reproduce an application configuration in another compatible Kubernetes environment.
Deploy through Kubernetes Dashboard
Kubernetes Dashboard allows YAML or JSON content to be entered directly and applied to the currently selected namespace.
1Open the target namespace
Sign in to Kubernetes Dashboard and select the namespace where the resources should be created.
2Create from input
Open the resource-creation interface and choose the option to create resources from direct input.
3Paste YAML or JSON
Paste the complete resource definition into the editor and submit it to Kubernetes.
Deploy with kubectl
When working from the command line, apply the deployment manifest by passing the correct file path to kubectl apply:
kubectl apply -f /path/to/deployment.yaml
Kubernetes reads the resource definitions in the file and creates or updates the corresponding objects in the cluster.
kubectl context points to the intended cluster and that the YAML uses the correct namespace, API versions, resource names, and configuration values.
YAML vs Helm
Direct YAML deployment and Helm charts are related approaches, but Helm adds a templating and package-management layer on top of Kubernetes manifests.
kubectl apply -f. No additional deployment tool is required.
