why node is not part of namespace?

6/24/2021

I am learning Kubernetes and I am having some doubt I read that Node can't be a part of the namespace and as shown below.

$ kubectl api-resources 

NAME                              SHORTNAMES   APIGROUP     NAMESPACED   KIND
nodes                             no                         false        Node

It is mentioned that POD can be part of namespaces but my question is if the POD can be part of namespaces then why not Node? because POD presents inside node?

Any help on this would be very helpful.

-- Shailesh Yadav
google-kubernetes-engine
kubernetes

2 Answers

6/24/2021

A namespace is virtually you are defining while your Node and work load are actual stuff that is running.

Namespaces are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about namespaces at all. Start using namespaces when you need the features they provide.

consider the namespace as tag you are virtually assigning it doesn't matter where it is running.

Node is a physical thing and a container(POD) is running top of it.

Note:

With configuration, you can make it possible to run a specific type of PODs (which are of single namespace) on a specific node but still for that thing you have to create the extra configuration.

But again it's design stuff of your application, if you want to do it or not.

For example, You created a namespace with the name Database and running MySQL container.

another namespace with the name Application running the WordPress container.

Both can run on same Node.

-- Harsh Manvar
Source: StackOverflow

6/24/2021

I think it is more a design choice, see: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#not-all-objects-are-in-a-namespace

Actually, your pods can be deployed on any nodes. If nodes can be assigned to a namespace, it means that the scheduler would only be able to schedule pods on a node if they share the same namespaces.

-- Arnaud Develay
Source: StackOverflow