0
0
Kubernetesdevops~15 mins

Default namespaces overview in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Default namespaces overview
📖 Scenario: You are managing a Kubernetes cluster. Namespaces help organize resources like pods and services. By default, Kubernetes creates some namespaces automatically.Understanding these default namespaces helps you know where your resources live and how to manage them.
🎯 Goal: You will list the default namespaces in a Kubernetes cluster and display their names.
📋 What You'll Learn
Use kubectl commands to interact with the cluster
List all namespaces
Extract only the namespace names
Print the list of default namespaces
💡 Why This Matters
🌍 Real World
Namespaces help organize and separate resources in a Kubernetes cluster, making management easier and safer.
💼 Career
Understanding default namespaces is essential for Kubernetes administrators and DevOps engineers to manage cluster resources effectively.
Progress0 / 4 steps
1
List all namespaces
Run the command kubectl get namespaces to list all namespaces in the cluster.
Kubernetes
Need a hint?

Use kubectl get namespaces to see all namespaces.

2
Extract only the namespace names
Use kubectl get namespaces -o jsonpath='{.items[*].metadata.name}' to get only the names of the namespaces.
Kubernetes
Need a hint?

Use the -o jsonpath= option to extract specific fields.

3
Format the output for readability
Add | tr ' ' '\n' to the previous command to print each namespace name on a new line.
Kubernetes
Need a hint?

Use tr command to replace spaces with new lines.

4
Display the default namespaces
Run the full command kubectl get namespaces -o jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' and print the output to show the default namespaces.
Kubernetes
Need a hint?

The output should list these default namespaces: default, kube-system, kube-public, and kube-node-lease.