创建DaemonSet
功能介绍
This API is used to create a DaemonSet resource object.
URI
POST /apis/apps/v1/namespaces/{namespace}/daemonsets
参数 |
是否必选 |
描述 |
---|---|---|
namespace |
Yes |
Object name and auth scope, such as for teams and projects. |
pretty |
No |
If 'true', then the output is pretty printed. |
请求消息
请求参数:
请求参数如表2所示。
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
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. |
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. |
metadata |
Yes |
metadata object |
Standard object's metadata. |
spec |
Yes |
spec object |
The desired behavior of this daemon set. |
status |
No |
status object |
The current status of this daemon set. This data may be out of date by some window of time. Populated by the system. Read-only. |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
minReadySeconds |
No |
Integer |
The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready). |
revisionHistoryLimit |
No |
Integer |
The number of old history to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10. |
selector |
No |
selector object |
A label query over pods that are managed by the daemon set. Must match in order to be controlled. If empty, defaulted to labels on Pod template. |
template |
Yes |
template object |
An object that describes the pod that will be created. The DaemonSet will create exactly one copy of this pod on every node that matches the template's node selector (or on every node if no node selector is specified). |
templateGeneration |
No |
Integer |
DEPRECATED. A sequence number representing a specific generation of the template. Populated by the system. It can be set only during the creation. |
updateStrategy |
No |
updateStrategy object |
An update strategy to replace existing DaemonSet pods with new pods. |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
collisionCount |
No |
Integer |
Count of hash collisions for the DaemonSet. The DaemonSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision. |
currentNumberScheduled |
No |
Integer |
The number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod. |
desiredNumberScheduled |
No |
Integer |
The total number of nodes that should be running the daemon pod (including nodes correctly running the daemon pod). |
numberAvailable |
No |
Integer |
The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds) |
numberMisscheduled |
No |
Integer |
The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. |
numberReady |
No |
Integer |
The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready. |
numberUnavailable |
No |
Integer |
The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds) |
observedGeneration |
No |
Integer |
The most recent generation observed by the daemon set controller. |
updatedNumberScheduled |
No |
Integer |
The total number of nodes that are running updated daemon pod |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
metadata |
Yes |
metadata object |
Standard object's metadata. |
spec |
Yes |
Object |
Specification of the desired behavior of the pod. |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
rollingUpdate |
Yes |
Object |
Rolling update config params. Present only if type = "RollingUpdate". |
type |
No |
String |
Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is OnDelete. |
请求示例:
{ "kind": "DaemonSet", "apiVersion": "extensions/v1beta1", "metadata": { "name": "daemonset-test", "labels": { "name": "daemonset-test" }, "enable": true }, "spec": { "selector": { "matchLabels": { "name": "daemonset-test" } }, "template": { "metadata": { "labels": { "name": "daemonset-test" }, "enable": true }, "spec": { "containers": [ { "name": "daemonset-test", "image": "172.16.5.235:20202/test/nginx", "imagePullPolicy": "IfNotPresent" } ], "imagePullSecrets": [{ "name": "default-secret" }] } } } }
响应消息
响应参数:
响应参数的详细描述请参见表2
响应示例:
{ "kind": "DaemonSet", "apiVersion": "extensions/v1beta1", "metadata": { "name": "daemonset-test", "namespace": "default", "selfLink": "/apis/extensions/v1beta1/namespaces/default/daemonsets/daemonset-test", "uid": "f9808766-fc23-11e7-9c3c-fa163eb8ad1a", "resourceVersion": "487764", "generation": 1, "creationTimestamp": "2018-01-18T07:48:29Z", "labels": { "name": "daemonset-test" }, "enable": true }, "spec": { "selector": { "matchLabels": { "name": "daemonset-test" } }, "template": { "metadata": { "creationTimestamp": null, "labels": { "name": "daemonset-test" }, "enable": true }, "spec": { "containers": [ { "name": "daemonset-test", "image": "172.16.5.235:20202/test/nginx", "resources": {}, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File", "imagePullPolicy": "IfNotPresent" } ], "restartPolicy": "Always", "terminationGracePeriodSeconds": 30, "dnsPolicy": "ClusterFirst", "securityContext": {}, "imagePullSecrets": [ { "name": "default-secret" } ], "schedulerName": "default-scheduler" } }, "updateStrategy": { "type": "OnDelete" }, "templateGeneration": 1, "revisionHistoryLimit": 10 }, "status": { "currentNumberScheduled": 0, "numberMisscheduled": 0, "desiredNumberScheduled": 0, "numberReady": 0 } }
