Skip to main content
In this solution walkthrough, we’ll explore how to list and count namespaces, inspect pods within them, deploy resources, and leverage DNS-based service discovery both within the same namespace and across namespaces.

1. List and Count Namespaces

You can view all namespaces in your cluster using:
Example output:
There are 10 namespaces in total.
You can add -o wide or use -o jsonpath to customize the output format.

2. Count Pods in the research Namespace

To see how many pods are running in research:
Example:
There are 2 pods in this namespace.

3. Create a Pod in the finance Namespace

Deploy a Redis pod into finance:
Verify the pod:
Example:

4. Locate the blue Pod Across All Namespaces

To identify which namespace hosts the blue pod:
Sample output shows blue in marketing:

5. Service DNS Within the Same Namespace

Services in the same namespace can be reached by <service-name>:<port>. In marketing:
Example:
The blue app connects to db-service on:
  • Host: db-service
  • Port: 6379
The image shows a "Connectivity Test" interface with fields for "Host Name" and "Host Port," and a "TEST" button. The result indicates "Success!" for the connection test.

6. Service DNS Across Namespaces

Accessing a service in a different namespace (e.g., dev) requires the full DNS name:
Verify the service definition:
Example:
Always use the full DNS (<svc>.<namespace>.svc.cluster.local) when connecting across namespaces to avoid resolution errors.

Watch Video