If you set your namespace to dev but then try to interact with a system pod in kube-system , your command will fail unless you explicitly use the -n kube-system flag. Remember: setting a default namespace doesn't lock you into it; it just sets the starting point.
Some admins prefer NOT to set the namespace permanently. Instead, they use shell aliases. kubectl set namespace
While setting a namespace permanently improves efficiency, it introduces a significant risk: . If you set your namespace to dev but
: The action of defining or updating a cluster/user/namespace grouping. kubectl set namespace
If you are creating a brand new context (perhaps for a new cluster user), you can set the namespace during creation: