What does a kubernetes namespace represents in cluster?

1/11/2019

What is the physical representation of a namespace in cluster (I am using AWS) is it an EC2 server?

Can someone help me understand by giving a metaphor of what is the physical representation of:

  1. Cluster
  2. Namespace
  3. Pods
  4. Containers
-- Vishrant
kubernetes

2 Answers

1/11/2019

Let's think of namespace as linux file system and ignore the fact of mounted directories for the sake of this question:

/srv => namespace-1
/var => namespace-2
/mnt => namespace-3
/bin => namespace-4
  • All these 4 directories belongs to same /
  • Inside a directory, you can have different type of files
  • If you do ls /srv you won't see files in /var
  • Different users can have different type of permissions on each directory

Now let's apply above 4 points in from the view of k8s namespace

  • All these 4 namespaces belongs to same kubernetes cluster
  • Inside a namespace, you can have different type of kubernetes objects
  • If you do kubectl get deployments from namespace-1, you won't see deployments in namespace-2
  • Different users can have different type of authorization on each namespaces
-- Suku
Source: StackOverflow

1/11/2019

The short answer is - there is no physical representation of a namespace.

A namespace is a high-level abstraction that logically groups and manages Kubernetes resources (for example by type of environment development/staging/production). This helps in separating resources in the way that a resource from one namespace does not have access to the resources in other namespaces.

A cluster is a group of machines.

A container represents a real docker container running in one of the cluster nodes. You could assume a virtual image running inside a physical machine.

A pod represents group of containers (usualy 1 container, but can be more in case of sidecar deployment) deployed from single deployment resource (Deployment, ReplicaSet etc).

-- Alik Khilazhev
Source: StackOverflow