Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I want to create multiple namespaces from the Kubernetes CLI (kubectl) without any YAML manifests:
kubectl
kubectl create namespace app1,app2,app3
Can this be done?
kubectl expects exactly one namespace:
➜ / kubectl create ns error: exactly one NAME is required, got 0
depending on your shell you could pack it into a loop. here's an example for bash and zsh:
➜ / foreach ns (ns1 ns2 ns3); kubectl create ns $ns; end
Add a comment
You could chain together 2 kubectl commands like so:
kubectl create ns app1 && kubectl create ns app2...
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.