Working with Pods
Simple Nginx Pod
Let's create a simple pod with Nginx container. We can create this in two ways - imperative or declarative (manifests).
Imperative command
kubectl run nginx-pod --image=nginx
kubectl run nginx-pod --image=nginx pod/nginx-pod created
Manifest
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx-container
image: nginx
kubectl apply -f 1-pod.yaml pod/nginx-pod created
Once the Pod is created, check the status:
kubectl get pods
kubectl get pods NAME READY STATUS RESTARTS AGE nginx-pod 1/1 Running 0 10m