Steps to create Custom Namespace in the Kubernetes

create Custom Namespace in the Kubernetes

In this blog, We will show you the steps to create Custom Namespace in the Kubernetes Environment.

 

REQUIREMENTS

  • 2 Node Cluster ( 1 Master VM with 2 Nodes)
  • Kubernetes Components

 

INFRASTRUCTURE OVERVIEW

  • We have already installed and configured the 2 Node cluster in our demo environment.

 

CREATE A CUSTOM NAMESPACE THROUGH KUBECTL

  • Log in to the master server through putty.

Steps to create Custom Namespace in the Kubernetes

 

  • Use this command to list all the available namespaces in your environment.

kubectl get namespaces

Steps to create Custom Namespace in the Kubernetes

 

  • To create a namespace, use kubectl create command.

Syntax: kubectl create namespace <namespace name>

Example: kubectl create namespace aznamespace

Steps to create Custom Namespace in the Kubernetes

 

  • Command executed successfully.

Steps to create Custom Namespace in the Kubernetes

 

  • Verify the new namespace.

Steps to create Custom Namespace in the Kubernetes

 

CREATE A CUSTOM NAMESPACE THROUGH YAML

  • Create a new file and add the below coding.

Steps to create Custom Namespace in the Kubernetes

apiVersion: v1
kind: Namespace
metadata:
   name: custom-namespace

Steps to create Custom Namespace in the Kubernetes

 

  • Save and close the file.
  • Use the below command to create a namespace using YAML file.

kubectl apply -f ns.yml

Steps to create Custom Namespace in the Kubernetes

 

  • Command executed successfully.

Steps to create Custom Namespace in the Kubernetes

 

  • Verify the new custom namespace.

Steps to create Custom Namespace in the Kubernetes

 

CREATE A NEW POD IN CUSTOM NAMESPACE

  • Use the kubectl command to create a POD

Syntax: kubectl run <pod name> --image=<image name> --port=<container port> --generator=run-pod/v1 -n <namespace name>

Example: kubectl run ns-pod --image=nginx --port=80 --generator=run-pod/v1 -n aznamespace

Steps to create Custom Namespace in the Kubernetes

 

  • Command executed successfully.

Steps to create Custom Namespace in the Kubernetes

 

  • Verify the pod details using the below command.

Syntax: kubecl get pods --namespace <namespace name>

Example: kubectl get pods --namespace aznamespace

Steps to create Custom Namespace in the Kubernetes

Note: Kubernetes will always list the pods from the default namespace. you need to specify the namespace name to display the objects in it.

 

DELETING THE NAMESPACE

  • To delete all the pods in a namespace.

Syntax: kubectl delete pods --all --namespace <namespace name>

Example: kubectl delete pods --all --namespace aznamespace

Steps to create Custom Namespace in the Kubernetes

 

  • Verify the POD availability in your custom namespace.

Steps to create Custom Namespace in the Kubernetes

 

  • To delete a namespace.

Syntax: kubectl delete namespace <namespace name>

Example: kubectl delete namespace aznamespace

Steps to create Custom Namespace in the Kubernetes

 

  • Verify the available namespaces in your environment.

Steps to create Custom Namespace in the Kubernetes

Steps to create Custom Namespace in the Kubernetes

EXTERNAL LINKS

https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

 

VIDEO

Thanks for reading this blog. We hope it was useful for you to learn about custom namespaces in kubernetes.

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn
More Interested Related Posts
How to create SWAP CentOS7space on /RHEL7

What is Swap Space?
 When an operating system no longer can put data on RAM then it uses some area of hard disk space to store data that area is called “SWAP space”.
 The SWAP space/partition is space on a disk created for use by the operating system, when your physical RAM usage exists 75% then the swap memory will act as a virtual RAM memory on the server. It can either be a partition or a file on a disk.

zfs pool usage
ZFS Pool and Dataset Usage

I am back with another blog to provide the useful script to the Freebsd users to determine the zpool and it’s datasets usage report. This

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support