POD - Sandeep-K-Khandelwal/CKAD GitHub Wiki

Kubernetes does not deploy containers directly on the worker nodes. The containers are encapsulated into a Kubernetes object known as PODs. A POD is a single instance of an application. A POD is the smallest object, that you can create in Kubernetes.

Commands -

  • Create a POD - kubectl run <pod_name> --image=<image_name>
  • See a list of available PODs - kubectl get pods
  • See details about a POD - kubectl describe pod <pod_name>
  • Delete a pod - kubectl delete pod <pod_name>
  • Edit an existing pod (you can edit only the image name with this option) - kubectl edit pod <pod_name>
  • Edit an existing pod other than image name - Edit the file using the above command and save the file. Once the file is saved, delete the POD and recreate the pod using kubectl create -f <file_name>
  • Another option to update the image name for the POD - kubectl set image pod <pod_name> <container_name>=<new image name>

YAML Definition YAML file

apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
  labels:
    app: myapp
    type: front-end
spec:
  containers:
    - name: nginx-container
      image: nginx
⚠️ **GitHub.com Fallback** ⚠️