更新时间:2022-04-18 GMT+08:00
分享

创建ReplicationController

功能介绍

该API用于创建ReplicationController资源类型。

URI

POST /api/v1/namespaces/{namespace}/replicationcontrollers

表1 描述该API的参数。

表1 参数说明

参数

是否必选

描述

pretty

No

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

namespace

Yes

Object name and auth scope, such as for teams and projects.

请求消息

请求参数:

请求参数的详细描述请参见表1

请求示例:

{
    "kind": "ReplicationController",
    "apiVersion": "v1",
    "metadata": {
        "name": "frontend-controller",
        "labels": {
            "cce/group": "frontend-controller",
            "name": "frontend"
        }
    },
    "spec": {
        "replicas": 2,
        "selector": {
            "cce/group": "frontend-controller",
            "name": "frontend"
        },
        "template": {
            "metadata": {
                "labels": {
                    "cce/group": "frontend-controller",
                    "name": "frontend"
                }
            },
            "spec": {
                "volumes": null,
                "containers": [
                    {
                        "name": "php-redis",
                        "image": "redis",
                        "ports": [
                            {
                                "containerPort": 80,
                                "protocol": "TCP"
                            }
                        ],
                        "imagePullPolicy": "IfNotPresent"
                    }
                ],
                "restartPolicy": "Always",
                "dnsPolicy": "ClusterFirst"
            }
        }
    }
}

响应消息

响应参数:

响应参数的详细描述请参见请求消息

响应示例:

{
    "apiVersion": "v1",
    "kind": "ReplicationController",
    "metadata": {
        "creationTimestamp": "2017-06-23T08:40:52Z",
        "generation": 1,
        "labels": {
            "cce/group": "frontend-controller",
            "name": "frontend"
        },
        "name": "frontend-controller",
        "namespace": "default",
        "resourceVersion": "850929",
        "selfLink": "/api/v1/namespaces/default/replicationcontrollers/frontend-controller",
        "uid": "aa123f3f-57ef-11e7-97f8-fa163e61f3f9"
    },
    "spec": {
        "replicas": 2,
        "selector": {
            "cce/group": "frontend-controller",
            "name": "frontend"
        },
        "template": {
            "metadata": {
                "creationTimestamp": null,
                "labels": {
                    "cce/group": "frontend-controller",
                    "name": "frontend"
                }
            },
            "spec": {
                "containers": [
                    {
                        "image": "redis",
                        "imagePullPolicy": "IfNotPresent",
                        "name": "php-redis",
                        "ports": [
                            {
                                "containerPort": 80,
                                "protocol": "TCP"
                            }
                        ],
                        "resources": {},
                        "terminationMessagePath": "/dev/termination-log"
                    }
                ],
                "dnsPolicy": "ClusterFirst",
                "restartPolicy": "Always",
                "securityContext": {},
                "terminationGracePeriodSeconds": 30
            }
        }
    },
    "status": {
        "availableReplicas": 2,
        "fullyLabeledReplicas": 2,
        "observedGeneration": 1,
        "readyReplicas": 2,
        "replicas": 2
    }
}

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

201

操作成功,返回ReplicationController资源对象。

异常状态码请参见状态码

分享:

    相关文档

    相关产品

关闭导读