liveBook · Manning

Namespace object

As explained in Kubernetes in Action, Second Edition

A namespace object is a Kubernetes API resource representing a namespace and its lifecycle state.

A namespace object is a Kubernetes API resource that represents a namespace and its lifecycle state. Namespaces organize resources and can be created directly with kubectl or declared in a YAML manifest. section 7.1.2

Create a namespace

Create one immediately with `kubectl create namespace kiada-test1`, or apply a manifest defining `apiVersion: v1`, `kind: Namespace`, and `metadata.name: kiada-test2`. Operators can include Namespace objects with application manifests for coordinated deployment. section 7.1.2

Listing 7.1 A YAML definition of a Namespace object
apiVersion: v1
kind: Namespace     #1
metadata:
  name: kiada-test2     #2

Use the YAML definition to inspect the minimal structure of a Namespace object. section 7.1.2

Deleting a Namespace object deletes all objects in that namespace automatically. Deletion can remain in `Terminating` when an object cannot be removed, commonly because a custom controller has not processed its finalizer; inspect namespace status with `kubectl get ns NAME -o yaml`. section 7.1.5

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines creation and cascading deletion, then diagnoses stuck Terminating status through namespace conditions and finalizers.
Examples
Demonstrates kubectl creation, a v1 YAML manifest, application with kubectl apply, deletion, and Terminating status inspection.
What it assumes
Assumes basic kubectl and Kubernetes API familiarity while teaching namespace manifests, deletion behavior, and status inspection.
What you can do after
Operate/configure namespaces with kubectl and manifests, delete them safely, and diagnose termination blocked by remaining objects.
How it connects
Connects namespaces with Kubernetes API resources, YAML manifests, kubectl, custom controllers, finalizers, and cascading deletion.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.