Creating a Namespace
Function
This API is used to create a Namespace.
Request
Request parameters:
Table 2 describes the request parameters.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
kind |
Yes |
String |
kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. The value of this parameter is Namespace. |
|
apiVersion |
Yes |
String |
apiVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. The value of this parameter is v1. |
|
metadata |
Yes |
metadata object |
- |
|
spec |
No |
spec object |
- |
|
status |
No |
status object |
- |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
finalizers |
No |
Array of strings |
finalizers is an opaque list of values that must be empty to permanently remove object from storage. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
phase |
No |
String |
phase is the current lifecycle phase of the namespace. |
Example request:
{
"apiVersion":"v1",
"kind": "Namespace",
"metadata": {
"name": "development",
"labels": {
"name": "development"
}
},
"spec": {
"finalizers": ["kubernetes"]
},
"status": {
"phase": "Active"
}
}
Response
Response parameters:
For the description about response parameters, see the parameter description in Request.
Example response:
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": {
"name": "development",
"selfLink": "/api/v1/namespaces/development",
"uid": "c98a9a98-595c-11e6-b444-286ed488fafe",
"resourceVersion": "16578",
"creationTimestamp": "2016-08-03T09:29:33Z",
"labels": {
"name": "development"
}
},
"spec": {
"finalizers": [
"kubernetes"
]
},
"status": {
"phase": "Active"
}
}
Status Code
Table 5 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
201 |
This operation succeeds, and a Namespace resource object is returned. |
For the description about status codes, see section Status Code.
Last Article: Namespace
Next Article: Deleting a Namespace
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.