Create an NGINX Pod In a Declarative Way
Create a YAML file containing the pod specifications.
apiVersion: v1
kind: Pod
metadata:
name: web-pod
labels:
app: web
spec:
containers:
- name: web-server
image: nginx
Create the pod using the YAML template “kubectl apply” command
kubectl apply -f filename.yaml
Verify that the pod has been created using “kubectl get pods” and “kubectl describe pod” commands.
kubectl get pods
kubectl describe pod web-pod