Create Pods in Kubernetes Cluster

Ticker

6/recent/ticker-posts

Create Pods in Kubernetes Cluster

 Question : The Nautilus DevOps team has started practicing some pods and services deployment on Kubernetes platform as they are planning to migrate most of their applications on Kubernetes platform. Recently one of the team members has been assigned a task to create a pod as per details mentioned below:

Create a pod named pod-httpd using the image httpd with latest tag only and remember to mention tag i.e httpd:latest.

Labels app should be named as httpd_app, also container should be named as httpd-container.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.


Please Note:-  Perform the below commands based on your question server,  user name & other details that might differ. So please read the task carefully before executing it. All the Best 👍

Solution:  

1. At first  kubectl  utility configure and working from jump server, run below commands   

thor@jump_host /$ kubectl get namespace

NAME              STATUS   AGE

default           Active   12m

kube-node-lease   Active   12m

kube-public       Active   12m

kube-system       Active   12m

thor@jump_host /$

thor@jump_host /$ kubectl get pods

No resources found in default namespace.

thor@jump_host /$

2.  Create yaml  file with all the parameters , you can copy form gitlab

    https://gitlab.com/nb-tech-support/devops.git

    Refer Below Video for more clarity )

thor@jump_host /$ vi /tmp/pod.yaml

thor@jump_host /$ cat /tmp/pod.yaml

apiVersion: v1

kind: Pod

metadata:

    name: pod-httpd

    labels:

      app: httpd_app

spec:

    containers:

    - name: httpd-container

      image: httpd:latest

 thor@jump_host /$


3.  Run below command to create pod   

 

thor@jump_host /$ kubectl create -f /tmp/pod.yaml

pod/pod-httpd created

thor@jump_host /$

 


4.  Wait for  pods to get running status

thor@jump_host /$ kubectl get pods

NAME        READY   STATUS    RESTARTS   AGE

pod-httpd   1/1     Running   0          111s

thor@jump_host /$

thor@jump_host /$ kubectl get pods -o wide

NAME        READY   STATUS    RESTARTS   AGE    IP           NODE     NOMINATED NODE   READINESS GATES

pod-httpd   1/1     Running   0          107s   10.244.1.2   node01   <none>           <none>

thor@jump_host /$


5.  Click on Finish & Confirm to complete the task successful


Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , 

please go through and share your comments. Like and share the knowledge




Post a Comment

2 Comments

  1. 1:06 what did you do?

    ReplyDelete
    Replies
    1. I created yaml file & save it. you can also get download from git repo & execute it .

      Delete

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user