Kubernetes namespaces represents virtual clusters (logical entity with a unique name) created out of same physical cluster to enable allocation or split of cluster resources to different group of users. Namespaces are, primarily, used for managing cluster resources across dev/test/production environments by attaching different level of authorization controls and policies to different sections of cluster resources. In simpler words, it allows to create a community of users (developers, testers, production ops) in relation to some of the following:
This post aims to provide a list of commonly used commands (cheat sheet) to work with namespaces. This list can prove to be very useful when you are starting to work with Kubernetes namespaces.
kubectl get namespaces
kubectl get namespaces --show-labels
kubectl get namespaces <name>
kubectl describe namespaces <name>
kubectl create -f <yaml/json file consisting of namespace information>
Here is a sample json file for development namespace:
{ "kind": "Namespace", "apiVersion": "v1", "metadata": { "name": "development", "labels": { "name": "development" } } }
kubectl delete namespaces <name>
kubectl config view
kubectl config set-context <context-name> --namespace=<namespace-name> --cluster=<cluster-name> --user=<user-name><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>
kubectl config use-context <context name>
kubectl config current-context
In this post, you scanned through the list of commands in relation to Kubernetes Namespaces. Did you find this article useful? Do you have any questions about this article or Kubernetes namespaces commands? Leave a comment and ask your questions and I shall do my best to address your queries.
The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…
Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…
When building a Retrieval-Augmented Generation (RAG) application powered by Large Language Models (LLMs), which combine…
Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…
Artificial Intelligence (AI) agents have started becoming an integral part of our lives. Imagine asking…
In the ever-evolving landscape of agentic AI workflows and applications, understanding and leveraging design patterns…