Projects/Namespaces¶
Namespaces are intended for use in environments with many users spread across multiple teams, or projects.
Namespaces provide a scope for names. Names of resources need to be unique within a namespace, but not across namespaces.
Namespaces are a way to divide cluster resources between multiple users (via resource quota).
It is not necessary to use multiple namespaces just to separate slightly different resources, such as different versions of the same software: use labels to distinguish resources within the same namespace. In practice namespaces are often used to separate teams, applications, or stages of the CI/CD pipeline (dev, test, stage, prod).
Projects in OpenShift
An OpenShift Project is a Kubernetes namespace with extra metadata (display name, description) and default access control. When you run oc new-project, OpenShift creates the namespace and makes you its admin, even if you aren't allowed to create namespaces directly. Use oc new-project rather than oc create namespace on OpenShift.
Resources¶
References¶
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
namespace: dev
spec:
containers:
- name: myapp-container
image: busybox
command: ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"]