ConfigMap

简要概述

属于组:“corev1”

{Group: corev1.GroupName, Kind: "ConfigMap"}
staging/src/k8s.io/kubectl/pkg/describe/describe.go

代码路径:

staging/src/k8s.io/api/core/v1/types.go

在设计上不是用来保存大量数据的,保存的数据不可超过 1 MiB。

常用指令

TODO;

配置示例

TODO;

数据结构

ConfigMap

// ConfigMap holds configuration data for pods to consume.
type ConfigMap struct {
    metav1.TypeMeta `json:",inline"`
    // Standard object's metadata.
    // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    // +optional
    metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

    // Immutable, if set to true, ensures that data stored in the ConfigMap cannot
    // be updated (only object metadata can be modified).
    // If not set to true, the field can be modified at any time.
    // Defaulted to nil.
    // +optional
    Immutable *bool `json:"immutable,omitempty" protobuf:"varint,4,opt,name=immutable"`

    // Data contains the configuration data.
    // Each key must consist of alphanumeric characters, '-', '_' or '.'.
    // Values with non-UTF-8 byte sequences must use the BinaryData field.
    // The keys stored in Data must not overlap with the keys in
    // the BinaryData field, this is enforced during validation process.
    // +optional
    Data map[string]string `json:"data,omitempty" protobuf:"bytes,2,rep,name=data"`

    // BinaryData contains the binary data.
    // Each key must consist of alphanumeric characters, '-', '_' or '.'.
    // BinaryData can contain byte sequences that are not in the UTF-8 range.
    // The keys stored in BinaryData must not overlap with the ones in
    // the Data field, this is enforced during validation process.
    // Using this field will require 1.10+ apiserver and
    // kubelet.
    // +optional
    BinaryData map[string][]byte `json:"binaryData,omitempty" protobuf:"bytes,3,rep,name=binaryData"`
}