[Kubernetes] Pods with YAML
less than 1 minute read
YAML in K8S
apiVersion: v1 # v1 | apps/v1 # mandatory
kind: Pod # Pod | | Service | ReplicaSet | Deployment # mandatory
metadata: # mandatory
name:
labels:
key: value
spec: # mandatory
containers:
- name: nginx-container
image: nginx
$ kubectl create -f pod-definition.yaml
kubectl get pods
Example
# pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
tier: frontend
spec:
containers:
- name: nginx
image: nginx
kubectl apply -f pod.yaml
kubectl describe pod nginx