Creating a Deployment
Function
This API is used to create a deployment.
There are constraints on mounting OBS buckets during Deployment creation. For details, see Constraints on OBS Bucket Mounting.
URI
POST /apis/apps/v1/namespaces/{namespace}/deployments
|
Parameter |
Description |
|---|---|
|
namespace |
Object name and auth scope, such as for teams and projects. |
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
pretty |
Yes |
If 'true', then the output is pretty printed. |
Request
Request parameters
For the description about request parameters, see Table 79.
Example request
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "deployment-test"
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "redis"
}
},
"template": {
"metadata": {
"labels": {
"app": "redis"
}
},
"spec": {
"containers": [
{
"image": "redis",
"name": "container-0",
"resources": {
"limits": {
"cpu": "500m",
"memory": "1024Mi"
},
"requests": {
"cpu": "500m",
"memory": "1024Mi"
}
}
}
],
"imagePullSecrets": [
{
"name": "imagepull-secret"
}
],
"priority": 0
}
}
}
}
Response
Response parameters
Table 79 describes the response parameters.
Example response
{
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"name": "deployment-test",
"namespace": "namespace-test",
"selfLink": "/apis/apps/v1/namespaces/namespace-test/deployments/deployment-test",
"uid": "777dce52-b186-11e8-8cb0-c81fbe371a17",
"resourceVersion": "5630832",
"generation": 1,
"creationTimestamp": "2018-09-06T03:39:32Z",
"labels": {
"app": "redis"
},
"enable": true
},
"spec": {
"replicas": 1,
"priority": 0,
"selector": {
"matchLabels": {
"app": "redis"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "redis"
},
"annotations": {
"cri.cci.io/container-type": "secure-container"
},
"enable": true
},
"spec": {
"containers": [
{
"name": "container-0",
"image": "redis",
"resources": {
"limits": {
"cpu": "500m",
"memory": "1Gi"
},
"requests": {
"memory": "1Gi",
"cpu": "500m"
}
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"imagePullSecrets": [
{
"name": "imagepull-secret"
}
],
"schedulerName": "default-scheduler"
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": "25%",
"maxSurge": "25%"
}
},
"revisionHistoryLimit": 10,
"progressDeadlineSeconds": 600
},
"status": {}
}
Status Code
Table 3 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
201 |
This operation succeeds, and a Deployment resource object is returned. |
For more status codes, see Status Codes.
Last Article: Deployment
Next Article: Reading a Deployment
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.