Intro
Before jumping into Kubernetes resources, let’s take a look over a very important concept called Namespace.
Namespaces are a way to separate cluster resources.
Namespace-based scoping is applicable only for certain types of objects (e.g. Pods Deployments, Services, etc.) and not for cluster-wide objects (e.g. StorageClass, Nodes, PersistentVolumes, etc.).
Usage
Retrieve all defined namespaces.
>> kubectl get namespace
If none specified, the resources are created in the ‘default’ namespace.
Create a new namespace called ‘test’.
>> kubectl create namespace test
Create a pod in the newly created namespace.
>> kubectl run nginx-pod –-image=nginx –n test
We’ll talk about the pod object a lot more in the later posts.
For now, you only need to know that they are resources that can be grouped into different namespaces.
Retrieve all pods in the ‘test’ namespace.
>> kubectl get pods –n test
Follow the Kubernetes 101 series on mindit.io.
Check out new-spike.net for other articles on Kubernetes and much more!