podsdemo

Kubernetes pod yaml - Quick walkthrough


As part of this blog, we will deploy the pods_demo.yaml below in the Kubernetes cluster.




Steps to create pods in Kubernetes cluster:


  1. As a pre-requisite, you need to have a docker hub account to store the image in the repository to practice along. If you don't have it, you can simply copy the yaml from my github account and run it in your Kubernetes cluster

               github path : https://github.com/Iam-7hills/kubernetes/blob/main/pods/pods_demo.yaml


     2. Login into Kubernetes cluster and execute the below command to deploy the yaml file 


                kubectl create -f pods_demo.yaml

    

    3. To verify the installation

               kubectl get pods



 
4. To check the deployment log


                kubectl describe pods podsdemo


[jenkins@iam7hills kubes]$ kubectl describe pods podsdemo

Name:             podsdemo

Namespace:        default

Priority:         0

Service Account:  default

Node:             iam7hills/<IP number>

Start Time:       Tue, 19 Dec 2023 20:41:38 -0800

Labels:           <none>

----


Events:

  Type    Reason     Age    From               Message

  ----    ------     ----   ----               -------

  Normal  Scheduled  4m39s  default-scheduler  Successfully assigned default/podsdemo to iam7hills

  Normal  Pulled     4m36s  kubelet            Container image "iam7hills/learnkubernetes:podsdemo-1.0" already present on machine

  Normal  Created    4m36s  kubelet            Created container podsdemo

  Normal  Started    4m36s  kubelet            Started container podsdemo



5.  To verify the deployment, login into the containers


    kubectl exec -it podsdemo  /bin/sh




 


6. To delete pods

    Kubectl delete pods podsdemo

     kubectl delete -f pods_demo.yaml