To filter resources by namespace in Kubernetes, you can use the -n or --namespace flag with the kubectl command. Here are some examples:
Get all resources in a specific namespace:
kubectl get all -n <namespace-name>Get Pods in a specific namespace:
kubectl get pods -n <namespace-name>Get Deployments in a specific namespace:
kubectl get deployments -n <namespace-name>Get Services in a specific namespace:
kubectl get services -n <namespace-name>
Replace <namespace-name> with the name of the namespace you want to filter by.
If you want to set a default namespace for all subsequent commands, you can use:
kubectl config set-context --current --namespace=<namespace-name>
This way, you won't need to specify the namespace for each command. Let me know if you need further assistance!
