Create a kubernetes namespace using config instead of API

6/17/2016

The only way to create a new namespace according to documentation here is to make an API request

curl -v -X POST -d'{"apiVersion":"v1","kind":"Namespace","metadata":{"name":"kube-system"}}' -H "Content-Type: application/json" "http://127.0.0.1:8080/api/v1/namespaces"

Is there any way to do the same using config or cloud-config?

-- SerCe
docker
kubectl
kubernetes

1 Answer

6/17/2016

As Timo mentioned, you can use kubectl create namespace NAME to create a namespace using the command line client. You can also put the following into a yaml file and use kubectl create -f namespace.yaml to create a namespace:

apiVersion: v1
kind: Namespace
metadata:
  name: kube-system
-- Robert Bailey
Source: StackOverflow