How to view resources in a namespace in Kubernetes?
To view resources in a Kubernetes namespace, you can use the kubectl command line tool. Here are some commonly used commands:
- View all namespace resources.
kubectl get all --all-namespaces
- View all resources in a specified namespace.
kubectl get all -n <namespace>
- View the Pods in a specific namespace.
kubectl get pods -n <namespace>
- View the Deployments in a specific namespace.
kubectl get deployments -n <namespace>
- View the Service in the specified namespace.
kubectl get services -n <namespace>
- View the ConfigMap for a specific namespace.
kubectl get configmaps -n <namespace>
- View the Secret in a specific namespace:
kubectl get secrets -n <namespace>
- View the PersistentVolumes in a specific namespace.
kubectl get persistentvolumes -n <namespace>
These commands will display detailed information about the relevant resources in the specified namespace. More specific information can be obtained using other options and filters. For example, the -o option can be used to specify the output format, and the –sort-by option can be used to sort the results by a specific field. For detailed command options and usage, please refer to the documentation for kubectl.