>_ IzzyLab

Hands-on task

This task is step 1 of the course “Kubernetes: manifests from Namespace to RBAC”

Namespace with a label

easy~5 min

Prepare in /root/ns.yaml a Namespace staging with the label env: staging in metadata.labels. The skeleton is easy to generate with a kubectl command using --dry-run=client -o yaml, and the label can be added in the Editor tab — just like real manifest tweaking.

What you'll practise:
  • kubernetes
  • namespace
  • labels
  • kubectl
  • yq

Topic breakdown

A Namespace isolates cluster objects into logical groups, and labels in metadata.labels are used to select and group resources with selectors. The subtlety is that the kubectl create namespace generator can create a skeleton but won't set arbitrary labels — those have to be added separately. The realistic tweaking approach: generate the manifest with --dry-run=client -o yaml into a file, then add the right field with an editor like yq (in-place).

What's checked

  1. Manifest is valid
  2. Name is staging
  3. Label env=staging

What it looks like