Resume
- YAML in Kubernetes:
- Kubernetes uses YAML files to define objects like pods, deployments, services, etc.
- Each YAML file for a Kubernetes object requires four main fields: API version, kind, metadata, and spec.
- Key YAML Fields:
- API Version: Specifies the Kubernetes API version. For pods, this is usually
v1
.
- Kind: Defines the type of object, e.g.,
Pod
, Deployment
, or Service
.
- Metadata: Contains object metadata like name and labels. Labels help categorize and filter objects later.
- Spec: Details the configuration, such as container images. In the case of a pod, this specifies the
containers
list, where each container has a name
and image
.
- Creating a Pod with YAML:
- After defining a pod in YAML, use
kubectl create -f <filename>
to create it.
- To view the pod, use
kubectl get pods
; for detailed info, use kubectl describe pod <pod-name>
.