文档首页/ 云容器实例 CCI/ API参考/ 数据结构/ 请求数据结构(废弃)
更新时间:2022-08-31 GMT+08:00
分享

请求数据结构(废弃)

表1 v1.PodTemplate数据结构说明

参数

是否必选

参数类型

描述

kind

Yes

String

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 PodTemplate.

apiVersion

Yes

String

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

-

template

Yes

template object

-

表2 v1.Pod请求参数

参数

是否必选

参数类型

描述

kind

Yes

String

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 Pod.

apiVersion

Yes

String

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

Yes

spec object

-

status

No

status object

-

表3 status字段数据结构说明

参数

是否必选

参数类型

描述

phase

No

String

Current condition of the pod.

conditions

No

conditions object

Current service state of the pod.

message

No

String

A human readable message indicating details about why the pod is in this condition.

reason

No

String

A brief CamelCase message indicating details about why the pod is in this state. e.g. 'OutOfDisk'

hostIP

No

String

IP address of the host to which the pod is assigned. Empty if not yet scheduled.

podIP

No

String

IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.

startTime

No

String

RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.

containerStatuses

No

containerStatuses object

The list has one entry per container in the manifest. Each entry is currently the output of container inspect.

表4 conditions字段数据结构说明

参数

是否必选

参数类型

描述

type

No

String

Type of the condition. Currently only Ready.

status

No

String

Status of the condition. Can be True, False, or Unknown.

lastProbeTime

No

String

Last time we probed the condition.

lastTransitionTime

No

String

Last time the condition transitioned from one status to another.

reason

No

String

Unique, one-word, CamelCase reason for the condition's last transition.

message

No

String

Human-readable message indicating details about last transition.

表5 containerStatuses字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

This must be a DNS_LABEL. Each container in a pod must have a unique name. Cannot be updated.

state

No

state/lastState object

-

lastState

No

state/lastState object

-

ready

No

Boolean

Specifies whether the container has passed its readiness probe.

restartCount

No

Integer

The number of times the container has been restarted, currently based on the number of dead containers that have not yet been removed. Note that this is calculated from dead containers. However, those containers are subject to garbage collection. This value will get capped at 5 by GC.

image

Yes

String

The image the container is running.

imageID

No

String

ID of the container's image.

containerID

No

String

Container's ID in the format 'docker://'.

表6 state/lastState字段数据结构说明

参数

是否必选

参数类型

描述

waiting

No

waiting object

-

running

No

running object

-

terminated

No

terminated object

-

表7 waiting字段数据结构说明

参数

是否必选

参数类型

描述

reason

No

String

(Brief) Reason the container is not yet running.

message

No

String

Message regarding why the container is not yet running.

表8 running字段数据结构说明

参数

是否必选

参数类型

描述

startedAt

No

String

Time at which the container was last (re-)started.

表9 terminated字段数据结构说明

参数

是否必选

参数类型

描述

startedAt

No

Integer

Exit status from the last termination of the container.

signal

No

Integer

Signal from the last termination of the container.

reason

No

String

(Brief) reason from the last termination of the container.

message

No

String

Message regarding the last termination of the container.

startedAt

No

String

Time at which previous execution of the container started.

finishedAt

No

String

Time at which the container last terminated.

containerID

No

String

Container's ID in the format 'docker://'

表10 metadata字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated.

0 characters < name length ≤ 253 characters.

The name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

clusterName

No

String

The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.

说明:

除了evs卷,其他类型的卷不支持

initializers

No

initializers object

An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects. When an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user.

generateName

No

String

An optional prefix used by the server to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different from the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.

If this field is specified and the generated name exists, the server will NOT return a 409. Instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).

Applied only if Name is not specified.

0 characters < generated name length ≤ 253 characters.

The generated name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

namespace

No

String

Namespace defines the space within each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated.

0 characters < namespace length ≤ 63 characters.

The namespace must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

selfLink

No

String

A URL representing this object. Populated by the system. Read-only.

说明:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

uid

No

String

UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. Populated by the system. Read-only.

说明:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

resourceVersion

No

String

An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. Populated by the system. Read-only. Value must be treated as opaque by clients.

说明:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

generation

No

Integer

A sequence number representing a specific generation of the desired state. Currently only implemented by replication controllers. Populated by the system. Read-only.

creationTimestamp

No

String

A timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. Populated by the system. Read-only. Null for lists.

说明:

This field is automatically generated. Do not assign any value to this field. Otherwise, API calls would fail.

deletionTimestamp

No

String

RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource will be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field. Once set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. Once the resource is deleted in the API, the Kubelet will send a hard termination signal to the container. If not set, graceful deletion of the object has not been requested. Populated by the system when a graceful deletion is requested. Read-only.

deletionGracePeriodSeconds

No

Integer

Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.

labels

Yes

Map[string]string

Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services.

Annotations

No

Map[string]string

An unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects.

ownerReferences

No

ownerReferences object

(A newly added parameter in Kubernetes 1.3)

List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.

finalizers

No

Array of strings

(A newly added parameter in Kubernetes 1.3)

Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.

表11 initializers字段数据结构说明

参数

是否必选

参数类型

描述

pending

No

pending object

Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.

result

No

result object

If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion.

表12 pending字段数据结构说明

参数

是否必选

参数类型

描述

name

No

String

name of the process that is responsible for initializing this object.

表13 result字段数据结构说明

参数

是否必选

参数类型

描述

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.

code

No

Integer

Suggested HTTP return code for this status, 0 if not set.

details

No

details object

Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.

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.

message

No

String

A human-readable description of the status of this operation.

metadata

Yes

metadata object

Standard list metadata.

reason

No

String

A machine-readable description of why this operation is in the "Failure" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.

status

No

String

Status of the operation. One of: "Success" or "Failure".

表14 details字段数据结构说明

参数

是否必选

参数类型

描述

causes

No

causes object

The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.

group

No

String

The group attribute of the resource associated with the status StatusReason.

kind

No

String

The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind.

name

No

String

The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).

retryAfterSeconds

No

Integer

If specified, the time in seconds before the operation should be retried.

uid

No

String

UID of the resource. (when there is a single resource which can be described).

表15 metadata字段数据结构说明

参数

是否必选

参数类型

描述

resourceVersion

No

String

String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only.

selfLink

No

String

SelfLink is a URL representing this object. Populated by the system. Read-only.

表16 causes字段数据结构说明

参数

是否必选

参数类型

描述

field

No

String

The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional. Examples: "name" - the field "name" on the current resource "items[0].name" - the field "name" on the first array entry in "items"

message

No

String

A human-readable description of the cause of the error. This field may be presented as-is to a reader.

reason

No

String

A machine-readable description of the cause of the error. If this value is empty there is no information available.

表17 ownerReferences字段数据结构说明

参数

是否必选

参数类型

描述

apiVersion

Yes

String

API version of the referent.

blockOwnerDeletion

No

Boolean

If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Default to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.

kind

Yes

String

Kind of the referent.

name

Yes

String

Name of the referent.

uid

No

String

UID of the referent.

controller

No

Boolean

If true, this reference points to the managing controller.

表18 spec字段数据结构说明

参数

是否必选

参数类型

描述

replicas

No

Integer

The number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified.

Value range: ≥ 0.

Default: 1

minReadySeconds

No

Integer

Minimum number of seconds for which a newly created pod should be ready without any of its containers crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)

template

Yes

template object

-

selector

Yes

Map[string]string

A label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template.

表19 status字段数据结构说明

参数

是否必选

参数类型

描述

replicas

No

Integer

The most recently observed number of replicas.

availableReplicas

No

Integer

The number of available replicas (ready for at least minReadySeconds) for this replication controller.

readyReplicas

No

Integer

The number of ready replicas for this replication controller.

conditions

No

condition object

Represents the latest available observations of a replication controller's current state.

observedGeneration

No

Integer

Reflects the generation of the most recently observed replication controller.

FullylabeledReplicas

No

Map[string]string

-

表20 template字段数据结构说明

参数

是否必选

参数类型

描述

metadata

No

metadata object

-

spec

Yes

spec object

-

表21 condition字段数据结构说明

参数

是否必选

参数类型

描述

lastTransitionTime

No

Time

The last time the condition transitioned from one status to another.

message

No

String

A human readable message indicating details about the transition.

reason

No

String

The reason for the condition's last transition.

status

No

String

Status of the condition, one of True, False, Unknown.

type

No

String

Type of replication controller condition.

表22 spec字段数据结构说明

参数

是否必选

参数类型

描述

volumes

No

-

Not supported now.

affinity

No

affinity object

If specified, the pod's scheduling constraints

说明:

不允许用户设置affinity,默认使用软反亲和

containers

Yes

containers object

List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a pod. Cannot be updated.

restartPolicy

No

String

Restart policy for all containers within the pod.

Value:

  • Always
  • OnFailure
  • Never

Default: Always.

activeDeadlineSeconds

No

Integer

Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.

Value range of this parameter: > 0.

dnsPolicy

No

String

Set DNS policy for containers within the pod.

Value:

  • ClusterFirst
  • Default

Default: ClusterFirst.

hostAliases

No

hostAliases object

HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.

serviceAccountName

No

String

Name of the ServiceAccount used to run this pod.

0 characters < service account name length ≤ 253 characters.

The service account name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

说明:

不支持serviceaccount,所以不支持该字段

serviceAccount

No

String

DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.

schedulerName

No

String

If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.

说明:

不支持设置指定scheduler name

nodeName

No

String

A request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.

0 characters < node name length ≤ 253 characters.

The node name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

说明:

不支持设置nodeName

nodeSelector

No

Object

NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node.

说明:

不支持设置nodeSelector

automountServiceAccountToken

No

Boolean

AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.

hostNetwork

No

Boolean

Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false.

说明:

The hostport of the hostNetwork must be different from the containerport.

创建、更新pod时不支持使用主机网络

hostPID

No

Boolean

A flag indicating whether to use the host's pid namespace. Optional: Default to false.

说明:

The hostport of the hostNetwork must be different from the containerport.

创建、更新pod时不支持使用主机PID namespaces

hostIPC

No

Boolean

A flag indicating whether to use the host's ipc namespace. Optional: Default to false.

说明:

The hostport of the hostNetwork must be different from the containerport.

创建、更新pod时不支持使用主机IPC namespaces

securityContext

No

securityContext object

-

imagePullSecrets

No

imagePullSecrets object

A list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use.

说明:

使用的镜像是容器镜像服务界面上的“我的镜像”页签中的镜像时必须设置。

initContainers

No

containers object

List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed.

hostname

No

String

Specifies the hostname of the Pod. If not specified, the pod's hostname will be set to a system-defined value.

subdomain

No

String

If specified, the fully qualified Pod hostname will be"<hostname>.<subdomain>.<pod namespace>.svc<cluster domain>". If not specified, the pod will not have a domainname at all.

tolerations

No

tolerations object

If specified, the pod's tolerations.

表23 containers字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.

0 characters < container name length ≤ 63 characters.

The container name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

image

Yes

String

Container image name.

command

No

Array of strings

Entrypoint array. Not executed within a shell. The container image's entrypoint is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, for example, $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated.

args

No

Array of strings

Arguments to the entrypoint. The container image's cmd is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, for example, $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated.

workingDir

No

String

Container's working directory. Defaults to Container's default. Defaults to image's default. Cannot be updated.

ports

No

ports object

List of ports to expose from the container. Cannot be updated.

env

No

env object

List of environment variables to set in the container. Cannot be updated.

envFrom

No

envFrom object

List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.

resources

No

resources object

Minimum resources the volume should have.

volumeMounts

No

volumeMounts object

Pod volumes to mount into the container's filesystem. Cannot be updated.

livenessProbe

No

livenessProbe object

-

readinessProbe

No

livenessProbe object

-

lifecycle

No

lifecycle object

-

terminationMessagePath

No

String

Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Defaults to /dev/termination-log. Cannot be updated.

imagePullPolicy

No

String

Image pull policy. Defaults to Always if the :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.

Value:

  • Always
  • Never
  • IfNotPresent

securityContext

No

securityContext object

-

stdin

No

Boolean

A flag indicating whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.

stdinOnce

No

Boolean

A flag indicating whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true, the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container process that reads from stdin will never receive an EOF. Default is false.

tty

No

Boolean

A flag indicating whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.

表24 securityContext字段数据结构说明

参数

是否必选

参数类型

描述

seLinuxOptions

No

seLinuxOptions object

-

runAsUser

No

Integer

The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.

Value length: > 0 characters.

runAsNonRoot

No

Boolean

Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.

supplementalGroups

No

Array of integers

A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.

fsGroup

No

Integer

A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:

The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw.

表25 imagePullSecrets字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

Name of the referent.

须知:

创建应用时,使用的镜像是容器镜像服务界面上的“我的镜像”页签中的镜像,那么该参数的值必须设置为imagepull-secret 。

表26 hostPath字段数据结构说明

参数

是否必选

参数类型

描述

path

No

String

Path of the directory on the host.

表27 emptyDir字段数据结构说明

参数

是否必选

参数类型

描述

medium

No

String

What type of storage medium should back this directory. The default is "" which means to use the node's default medium. Must be an empty string (default) or Memory.

表28 gitRepo字段数据结构说明

参数

是否必选

参数类型

描述

repository

No

String

Repository URL.

revision

No

String

Commit hash for the specified revision.

表29 ports字段数据结构说明

参数

是否必选

参数类型

描述

name

No

String

If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.

0 characters < name length ≤ 15 characters.

The name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

hostPort

No

Integer

Number of the port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.

Value range: [1, 65535].

containerPort

No

Integer

Number of the port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.

Value range: [1, 65535].

protocol

No

String

Protocol for port.

Value:

  • TCP
  • UDP

Default: TCP.

hostIP

No

String

What host IP to bind the external port to.

表30 env字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

Name of the environment variable. Must be a C_IDENTIFIER.

value

No

String

Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, for example, $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "".

valueFrom

No

valueFrom object

-

表31 resources字段数据结构说明

参数

是否必选

参数类型

描述

limits

No

Object

Maximum amount of compute resources allowed.

requests

No

Object

Minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value.

云容器实例中Pod规格有限制,具体的限制请参见约束限制页面的“Pod规格”部分。

表32 volumeMounts字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

This must match the Name of a Volume.

0 character < name length ≤ 253 characters.

The name must be a regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?.

readOnly

No

Boolean

Mounted read-only if true, read-write otherwise (false or unspecified).

Value:

  • true
  • false

Default: false.

mountPath

No

String

Path within the container at which the volume should be mounted.

Value length: > 0 characters.

subPath

No

String

Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).

表33 livenessProbe字段数据结构说明

参数

是否必选

参数类型

描述

exec

No

exec object

-

httpGet

No

httpGet object

-

tcpSocket

No

tcpSocket object

-

initialDelaySeconds

No

Integer

Number of seconds after the container has started before liveness probes are initiated.

Value range: ≥ 0.

timeoutSeconds

No

Integer

Number of seconds after which the probe times out.

Value range: ≥ 0.

Default: 1.

periodSeconds

No

Integer

How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.

Value range: ≥ 0.

Default: 10.

successThreshold

No

Integer

Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.

Value range: ≥ 0.

Default: 1.

failureThreshold

No

Integer

Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.

Value range: ≥ 0.

Default: 3.

表34 lifecycle字段数据结构说明

参数

是否必选

参数类型

描述

postStart

No

postStart/preStop object

-

preStop

No

postStart/preStop object

-

表35 securityContext字段数据结构说明

参数

是否必选

参数类型

描述

capabilities

No

capabilities object

-

privileged

No

Boolean

Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host.

Value:

  • true
  • false

Default: false.

说明:

Run container in privileged mode

seLinuxOptions

No

seLinuxOptions object

-

runAsUser

No

Integer

The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.

runAsNonRoot

No

Boolean

Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.

Value:

  • true
  • false
表36 seLinuxOptions字段数据结构说明

参数

是否必选

参数类型

描述

user

No

String

SELinux user label that applies to the container.

role

No

String

SELinux role label that applies to the container.

type

No

String

SELinux type label that applies to the container.

level

No

String

SELinux level label that applies to the container.

表37 items字段数据结构说明

参数

是否必选

参数类型

描述

path

No

String

Relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'

fieldRef

No

fieldRef object

-

resourceFieldRef

No

resourceFieldRef object

Selects a resource of the container: only resources limits and requests. (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.

表38 valueFrom字段数据结构说明

参数

是否必选

参数类型

描述

fieldRef

No

fieldRef object

-

resourceFieldRef

No

resourceFieldRef object

Selects a resource of the container: only resources limits and requests. (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.

表39 exec字段数据结构说明

参数

是否必选

参数类型

描述

command

No

Array of strings

Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply executed, it is not run inside a shell, so traditional shell instructions ('|', etc) do not work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.

表40 httpGet字段数据结构说明

参数

是否必选

参数类型

描述

path

No

String

Path to access on the HTTP server.

port

Yes

String

Name or number of the port to access on the container. The port number must be in the range 1 to 65535. The port name must be an IANA_SVC_NAME.

host

No

String

Host name to connect to. Defaults to the pod IP address.

scheme

No

String

Scheme to use for connecting to the host. Defaults to HTTP.

表41 tcpSocket字段数据结构说明

参数

是否必选

参数类型

描述

port

Yes

String

Number or name of the port to access on the container. The port number must be in the range 1 to 65535. The port name must be an IANA_SVC_NAME.

表42 postStart/preStop字段数据结构说明

参数

是否必选

参数类型

描述

exec

No

exec object

-

httpGet

No

httpGet object

-

tcpSocket

No

tcpSocket object

TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported.

表43 capabilities字段数据结构说明

参数

是否必选

参数类型

描述

add

No

add object

Added capabilities.

drop

No

add object

Removed capabilities.

表44 fieldRef字段数据结构说明

参数

是否必选

参数类型

描述

apiVersion

No

String

Version of the schema the FieldPath is written in terms of. Defaults to "v1".

fieldPath

No

String

Path of the field to select in the specified API version.

表45 resourceFieldRef字段数据结构说明

参数

是否必选

参数类型

描述

containerName

No

String

Container name: required for volumes, optional for env vars.

resource

Yes

String

Required: resource to select.

divisor

No

Integer

Specifies the output format of the exposed resources, defaults to "1".

表46 add字段数据结构说明

参数

是否必选

参数类型

描述

name

Yes

String

Name of the resource.

namespaced

No

Boolean

A flag indicating whether a resource is namespaced or not.

Default: false.

kind

No

String

kind of the resource.

表47 affinity字段数据结构说明

参数

是否必选

参数类型

描述

nodeAffinity

No

nodeAffinity object

Describes node affinity scheduling rules for the pod.

podAffinity

No

podAffinity object

Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).

podAntiAffinity

No

podAffinity object

Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).

表48 nodeAffinity字段数据结构说明

参数

是否必选

参数类型

描述

preferredDuringSchedulingIgnoredDuringExecution

No

preferredDuringSchedulingIgnoredDuringExecution object

The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.

requiredDuringSchedulingIgnoredDuringExecution

No

requiredDuringSchedulingIgnoredDuringExecution object

If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.

表49 podAffinity字段数据结构说明

参数

是否必选

参数类型

描述

preferredDuringSchedulingIgnoredDuringExecution

No

preferredDuringSchedulingIgnoredDuringExecution object

The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which match the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.

requiredDuringSchedulingIgnoredDuringExecution

No

podAffinityTerm object

NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system will try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. RequiredDuringSchedulingRequiredDuringExecution []PodAffinityTerm json:"requiredDuringSchedulingRequiredDuringExecution,omitempty" If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.

表50 preferredDuringSchedulingIgnoredDuringExecution字段数据结构说明

参数

是否必选

参数类型

描述

preference

No

preference object

A node selector term, associated with the corresponding weight.

weight

No

Integer

Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.

表51 requiredDuringSchedulingIgnoredDuringExecution字段数据结构说明

参数

是否必选

参数类型

描述

nodeSelectorTerms

No

preference object

Required. A list of node selector terms. The terms are ORed.

表52 preference字段数据结构说明

参数

是否必选

参数类型

描述

matchExpressions

No

matchExpressions object

Required. A list of node selector requirements. The requirements are ANDed.

表53 matchExpressions字段数据结构说明

参数

是否必选

参数类型

描述

key

No

String

The label key that the selector applies to.

operator

No

String

Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.

values

No

String

An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.

表54 preferredDuringSchedulingIgnoredDuringExecution字段数据结构说明

参数

是否必选

参数类型

描述

podAffinityTerm

No

podAffinityTerm object

Required. A pod affinity term, associated with the corresponding weight.

weight

No

Integer

weight associated with matching the corresponding podAffinityTerm, in the range 1-100.

表55 podAffinityTerm字段数据结构说明

参数

是否必选

参数类型

描述

labelSelector

No

labelSelector object

A label query over a set of resources, in this case pods.

namespaces

No

Array[string]

namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace"

topologyKey

No

String

This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. For PreferredDuringScheduling pod anti-affinity, empty topologyKey is interpreted as "all topologies" ("all topologies" here means all the topologyKeys indicated by scheduler command-line argument --failure-domains); for affinity and for RequiredDuringScheduling pod anti-affinity, empty topologyKey is not allowed.

表56 labelSelector字段数据结构说明

参数

是否必选

参数类型

描述

matchExpressions

No

matchExpressions object

matchExpressions is a list of label selector requirements. The requirements are ANDed.

matchLabels

No

Object

(A newly added parameter in Kubernetes 1.7)

matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.

表57 matchExpressions字段数据结构说明

参数

是否必选

参数类型

描述

key

No

String

key is the label key that the selector applies to.

operator

No

String

operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

values

No

Array of strings

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

表58 hostAliases字段数据结构说明

参数

是否必选

参数类型

描述

hostnames

No

Array of strings

Hostnames for the above IP address.

ip

No

String

IP address of the host file entry.

表59 envFrom字段数据结构说明

参数

是否必选

参数类型

描述

configMapRef

No

configMapRef object

The ConfigMap to select from

prefix

No

String

An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.

secretRef

No

secretRef object

-

表60 configMapRef字段数据结构说明

参数

是否必选

参数类型

描述

name

No

String

Name of the referent.

optional

No

Boolean

Specify whether the ConfigMap must be defined

表61 secretRef字段数据结构说明

参数

是否必选

参数类型

描述

name

No

String

Name of the referent.

optional

No

Boolean

Specify whether the ConfigMap must be defined

表62 tolerations字段数据结构说明

参数

是否必选

参数类型

描述

effect

No

String

Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.

key

No

String

Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.

operator

No

String

Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.

tolerationSeconds

No

Integer

TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.

value

No

String

Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.

表63 DeleteOptions数据结构说明

参数

是否必选

参数类型

描述

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 DeleteOptions.

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.

gracePeriodSeconds

No

Integer

The duration in seconds before the object should be deleted. Value must be a non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.

orphanDependents

No

Boolean

Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.

propagationPolicy

No

String

Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.

preconditions

No

Preconditions object

Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.

表64 preconditions字段数据结构说明

参数

是否必选

参数类型

描述

uid

No

String

Specifies the target UID.

相关文档