Reading a Deployment

Function

This API is used to read a Deployment in a specified project.

URI

GET /apis/apps/v1beta1/namespaces/{namespace}/deployments/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

namespace

Yes

Namespace to which the Deployment you want to query belongs.

name

Yes

Name of the Deployment.

pretty

No

If 'true', then the output is pretty printed.

exact

No

Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.

export

No

Should this value be exported. Export strips fields that a user cannot specify.

Request

N/A

Response

For the description about response parameters, see Table 2.

Example response

{
    "kind": "Deployment", 
    "apiVersion": "apps/v1beta1", 
    "metadata": {
        "name": "deployment-test", 
        "namespace": "8f6c39e7c269440c881bba2fc49586d6", 
        "selfLink": "/apis/apps/v1beta1/namespaces/8f6c39e7c269440c881bba2fc49586d6/deployments/deployment-test", 
        "uid": "ed89a51c-2728-11e8-b891-84a9c46e8c8b", 
        "resourceVersion": "4510941", 
        "generation": 2, 
        "creationTimestamp": "2018-03-14T01:42:17Z", 
        "labels": {
            "appgroup": ""
        }, 
        "annotations": {
            "deployment.kubernetes.io/revision": "1", 
            "description": ""
        }, 
        "enable": true
    }, 
    "spec": {
        "replicas": 1, 
        "selector": {
            "matchLabels": {
                "app": "deployment-test"
            }
        }, 
        "template": {
            "metadata": {
                "creationTimestamp": null, 
                "labels": {
                    "app": "deployment-test"
                }, 
                "annotations": {
                    "com.huawei.scheduler/container-type": "secure-container", 
                    "metrics.alpha.kubernetes.io/custom-endpoints": "[{api:'',path:'',port:'',names:''}]"
                }, 
                "enable": true
            }, 
            "spec": {
                "containers": [
                    {
                        "name": "container-0", 
                        "image": "nginx:latest", 
                        "resources": {
                            "limits": {
                                "cpu": "1", 
                                "memory": "1024Mi"
                            }, 
                            "requests": {
                                "cpu": "1", 
                                "memory": "1024Mi"
                            }
                        }, 
                        "lifecycle": {}, 
                        "terminationMessagePath": "/dev/termination-log", 
                        "terminationMessagePolicy": "File", 
                        "imagePullPolicy": "Always"
                    }
                ], 
                "restartPolicy": "Always", 
                "terminationGracePeriodSeconds": 30, 
                "dnsPolicy": "ClusterFirst", 
                "securityContext": {}, 
                "imagePullSecrets": [
                    {
                        "name": "imagepull-secret"
                    }
                ], 
                "affinity": {}, 
                "schedulerName": "default-scheduler"
            }
        }, 
        "strategy": {
            "type": "RollingUpdate", 
            "rollingUpdate": {
                "maxUnavailable": 1, 
                "maxSurge": 0
            }
        }, 
        "revisionHistoryLimit": 2, 
        "progressDeadlineSeconds": 600
    }, 
    "status": {
        "observedGeneration": 2, 
        "replicas": 1, 
        "updatedReplicas": 1, 
        "unavailableReplicas": 1, 
        "conditions": [
            {
                "type": "Available", 
                "status": "True", 
                "lastUpdateTime": "2018-03-14T01:42:17Z", 
                "lastTransitionTime": "2018-03-14T01:42:17Z", 
                "reason": "MinimumReplicasAvailable", 
                "message": "Deployment has minimum availability."
            }, 
            {
                "type": "Progressing", 
                "status": "True", 
                "lastUpdateTime": "2018-03-14T01:42:17Z", 
                "lastTransitionTime": "2018-03-14T01:42:17Z", 
                "reason": "ReplicaSetUpdated", 
                "message": "ReplicaSet \"deployment-test-4094680052\" is progressing."
            }
        ]
    }
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

This operation succeeds, and a deployment resource object is returned.

For more status codes, see Status Codes.