liveBook · Manning

Kubernetes namespace

As explained in Machine Learning Platform Engineering

A Kubernetes namespace is a logical partition within a cluster for organizing and isolating resource names and workloads.

A Kubernetes namespace creates a virtual cluster inside a physical cluster. It scopes resource names and separates workloads so teams or applications can share infrastructure with fewer naming conflicts. Kubernetes uses the default namespace when no namespace is specified. section 3.3.5

Use namespaces to:

  • Organize pods, services, ReplicaSets, and other resources by team or application. section 3.3.5
  • Create a namespace with kubectl, then target it explicitly with commands such as kubectl get pod -n funny. section 3.3.5
  • Place a workload or service in the namespace by adding namespace under metadata in its manifest. section 3.3.5

Deploying into a namespace

Create funny, deploy hello-joker there, and inspect its resources with kubectl. The deployment produces three running pods, while a ClusterIP service is listed with kubectl get services -n funny. Services can be addressed with the namespace-qualified form joker-cluster-ip-service.funny.svc.cluster.local. section 3.3.5

apiVersion: apps/v1
kind: Deployment
metadata:
  name: joker-deployment
  namespace: funny  
  labels:
      app: fast-api
..

Inspect the manifest pattern that assigns a Deployment to a namespace through metadata.namespace. section 3.3.5

How Machine Learning Platform Engineering covers it

How deep it goes
Explains namespace scope, default behavior, kubectl queries, manifest placement, and service addressing without detailing cluster internals.
Examples
Uses the funny namespace, hello-joker Deployment, three pods, ClusterIP service, and namespace-qualified service address.
What it assumes
Assumes familiarity with Kubernetes resources and manifests while demonstrating namespace operations from creation onward.
What you can do after
Operate/configure namespaces with kubectl and Kubernetes manifests, then inspect namespace-scoped pods and services.
How it connects
Connects namespaces with Kubernetes clusters, deployments, pods, services, ReplicaSets, and service DNS.

Also explained in

Compare how 5 books explain Kubernetes namespace →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.