Learn how to run Kubectl command across different namespaces.

Command used in the video

./kubectl get secret --namespace aplc

How do I switch to a different namespace in Kubernetes?
If you want to use a different namespace, you can pass kubectl the –namespace flag.
For example, kubectl –namespace=mystuff references objects in the mystuff namespace.

How do I access Kubernetes service from another namespace?
In Kubernetes the namespace is used to isolate the resource, based on the use case services in different namespace may required to access the service located in another namespace and Kubernetes allow this by using ExternalName concept.

How do I get all the namespaces in kubectl?
To list the existing namespaces in a cluster ‘kubectl get namespace’ command is used. After executing the command, the following output will be generated: Observe that the Kubernetes object starts with four initial namespaces: Default, kube-node-lease, kube-public, and kube-system.