namespaces

  • logical grouping within a cluster to isolate resources
  • names of resources need to unique within a namespace, but not across namespaces
  • namespace-based scoping is applicable only for namespaced objects (ex- deployments, services, etc.)
  • every app should have their own namespace!
k get namespaces # list all namespaces
 
k delete namespaces <namespace> # delete a ns
 
k run aniket --image=nginx -n mealie # create a pod in a specific namespace
 
k config set-context --current --namespace=mealie # set the default namespace for a context 
 
k config view | grep namespace # get the current namespace

namespace.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: mealie

202508302353