Create Namespaces in Kubernetes Cluster

Ticker

6/recent/ticker-posts

Create Namespaces in Kubernetes Cluster

Question : The Nautilus DevOps team is planning to deploy some micro service on Kubernetes platform. The team has already set up a Kubernetes cluster and now they want to set up some namespaces, deployments etc. Based on the current requirements the team has shared the details below:

Create a namespace named dev and create a POD under it; name the pod dev-nginx-pod and use nginx image with latest tag only and remember to mention tag i.e nginx:latest.

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

    kubectl get namespace

    kubectl get pods


2. Create a new namespace as per the task    

thor@jump_host /$ kubectl create namespace dev

namespace/dev created

thor@jump_host /$

thor@jump_host /$ kubectl get namespace

NAME              STATUS   AGE

default           Active   3m24s

dev               Active   44s

kube-node-lease   Active   3m26s

kube-public       Active   3m26s

kube-system       Active   3m27s

thor@jump_host /$



3.  Run the below command to create a pod
    

thor@jump_host /$ kubectl run dev-nginx-pod --image=nginx:latest -n dev

pod/dev-nginx-pod created

thor@jump_host /$


4.  Wait for  pods to get running status       
 

thor@jump_host /$ kubectl get pods -n dev

NAME            READY   STATUS    RESTARTS   AGE

dev-nginx-pod   1/1     Running   0          89s

thor@jump_host /$


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

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

0 Comments

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