Skip to content

API 参考(v3beta1) ​

包 ​

apps.emqx.io/v3beta1 ​

v3beta1 包包含 apps.emqx.io v3beta1 API 组的 API Schema 定义。

资源类型 ​

Config ​

出现于:

字段说明默认值校验规则
roots ConfigRootsEMQX 的顶层配置根项。值必须与 JSON 兼容。Operator 会将可在运行时应用的根项序列化到 base.hocon,
并将 EMQX 启动时生效的设置序列化到 emqx.conf。
不支持 include、替换和重复声明等仅适用于 HOCON 的语法。
删除根项表示 Operator 不再管理该配置,但不会删除 EMQX 已持久化的值。
node.cookie 路径由 Operator 保留,不得在此处指定。

ConfigRoots ​

底层类型: JSON

出现于:

ConfigStatus ​

ConfigStatus 包含由控制器管理的协调检查点。 这些字段仅用于提供实现信息,将来可能会发生变化。

出现于:

字段说明默认值校验规则
desiredRevision stringspec.config.roots 中完整预期配置的修订版本。
runtimeRevision stringEMQX API 最近接受的运行时配置修订版本。
首次启动前,该值表示为集群引导暂存的修订版本。
desiredStartupRevision stringEMQX 启动时生效的预期设置修订版本。
activeStartupRevisions string arrayReady Pod 所使用的启动配置修订版本。
存在多个修订版本表示 Ready Pod 使用了不同版本的启动设置。

CoreNodesStatus ​

CoreNodesStatus 是单个 StatefulSet 所管理的 Core 节点的汇总状态。

出现于:

字段说明默认值校验规则
readyReplicas integerReady 副本数。
updatedReplicas integer已更新为预期 Pod 模板的副本数。
currentReplicas integer仍在运行旧 Pod 模板的副本数。

DSDBReplicationStatus ​

出现于:

字段说明默认值校验规则
name string数据库名称
numShards integer数据库的分片数
numShardReplicas integer分片副本总数
lostShardReplicas integer属于已丢失站点的分片副本总数
numTransitions integer当前正在转移所有权的分片数
minReplicas integer数据库各分片的最小复制因子
maxReplicas integer数据库各分片的最大复制因子

DSReplicationStatus ​

各数据库的 Durable Storage 复制状态摘要。

出现于:

字段说明默认值校验规则
dbs DSDBReplicationStatus array

EMQX ​

表示 EMQX 集群的自定义资源。

字段说明默认值校验规则
apiVersion stringapps.emqx.io/v3beta1
kind stringEMQX
metadata ObjectMeta有关 metadata 的字段,请参阅 Kubernetes API 文档。
spec EMQXSpecEMQX 集群的预期状态规格。
status EMQXStatusEMQX 集群的当前状态。

EMQXCoreTemplate ​

出现于:

字段说明默认值校验规则
metadata TemplateObjectMeta应用于此模板所生成对象的元数据。
spec EMQXCoreTemplateSpecCore 节点的预期状态规格。
更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
{ }

EMQXCoreTemplateSpec ​

出现于:

字段说明默认值校验规则
nodeSelector object (keys:string, values:string)Selector which must be true for the pod to fit on a node.
Must match a node's labels for the pod to be scheduled on that node.
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
nodeName stringRequest 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.
affinity AffinityAffinity for pod assignment
ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
tolerations Toleration arrayPod tolerations.
If specified, Pod tolerates any taint that matches the triple <key,value,effect> using the matching operator.
topologySpreadConstraints TopologySpreadConstraint arraySpecifies how to spread matching pods among the given topology.
dnsConfig PodDNSConfigSpecifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy (always ClusterFirst).
More info: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
replicas integer预期实例数。
对于 Core 节点,每个实例都具有稳定的标识。
1Minimum: 0
minReadySeconds integerMinReadySeconds is the minimum time (seconds) a pod must be Ready before it counts as available.
For core nodes this is applied to the StatefulSet (mirrors apps/v1 StatefulSetSpec.minReadySeconds);
for replicants, to the ReplicaSet (mirrors apps/v1 ReplicaSetSpec.minReadySeconds).
Omitted or zero matches the apps/v1 default (0).
Minimum: 0
command string arrayEntrypoint 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. Double $$ are reduced
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. $$(VAR_NAME) will
produce the string literal $(VAR_NAME). Escaped references will never be expanded, regardless
of whether the variable exists or not. Cannot be updated.
More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
Optional: {}
args string arrayArguments 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. Double $$ are reduced
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. $$(VAR_NAME) will
produce the string literal $(VAR_NAME). Escaped references will never be expanded, regardless
of whether the variable exists or not.
More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
ports ContainerPort arrayList of ports to expose from the container.
Exposing a port here gives the system additional information about the network connections a
container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that
port from being exposed. Any port which is listening on the default 0.0.0.0 address inside a
container will be accessible from the network.
Port names dashboard and dashboard-https are reserved by the Operator and cannot be supplied
in the template. The Operator derives these named ports from
spec.config.roots.dashboard.listeners for probes, Services, and per-Pod API requests.
Change their container port by changing the corresponding listener bind instead.
env EnvVar arrayList of environment variables to set in the container.
envFrom EnvFromSource arrayList of sources to populate environment variables from 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.
resources ResourceRequirementsCompute Resources required by this container.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
podSecurityContext PodSecurityContextPod-level security attributes and common container settings.{ fsGroup:1000 fsGroupChangePolicy:Always runAsGroup:1000 runAsNonRoot:true runAsUser:1000 }
containerSecurityContext SecurityContextSecurity options the container should be run with.
If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
initContainers Container arrayList 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, Liveness probes, or Startup 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.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
extraContainers Container arrayAdditional containers to run alongside the main container.
extraVolumes Volume arrayAdditional volumes to provide to a Pod.
extraVolumeMounts VolumeMount arraySpecifies how additional volumes are mounted into the main container.
livenessProbe ProbePeriodic probe of container liveness.
Container will be restarted if the probe fails.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
{ failureThreshold:3 httpGet:map[path:/status port:dashboard] initialDelaySeconds:60 periodSeconds:30 }
readinessProbe ProbePeriodic probe of container service readiness.
Container will be removed from service endpoints if the probe fails.
Strongly advised to keep the current default: it takes into account ongoing node evacuations managed
by the Operator as part of scaling operations and rolling updates.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
{ failureThreshold:1 httpGet:map[path:/api/v5/load_rebalance/availability_check port:dashboard] initialDelaySeconds:10 periodSeconds:5 timeoutSeconds:3 }
startupProbe ProbeStartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully.
If this probe fails, the Pod will be restarted, just as if the livenessProbe failed.
This can be used to provide different probe parameters at the beginning of a Pod's lifecycle,
when it might take a long time to load data or warm a cache, than during steady-state operation.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
lifecycle LifecycleActions that the management system should take in response to container lifecycle events.
persistentVolumeClaimSpec PersistentVolumeClaimSpecCore 节点数据存储的 PVC 规格。

EMQXNode ​

出现于:

字段说明默认值校验规则
name string节点名称
podName string对应的 Pod 名称
status string节点状态
otpRelease string节点所运行的 Erlang/OTP 版本
version stringEMQX 版本
role string节点角色,取值为 core 或 replicant
sessions integerMQTT 会话数
connections integer已连接的 MQTT 客户端数

EMQXReplicantTemplate ​

出现于:

字段说明默认值校验规则
metadata TemplateObjectMeta应用于此模板所生成对象的元数据。
spec EMQXReplicantTemplateSpecReplicant 节点的预期状态规格。
更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

EMQXReplicantTemplateSpec ​

出现于:

字段说明默认值校验规则
nodeSelector object (keys:string, values:string)Selector which must be true for the pod to fit on a node.
Must match a node's labels for the pod to be scheduled on that node.
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
nodeName stringRequest 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.
affinity AffinityAffinity for pod assignment
ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
tolerations Toleration arrayPod tolerations.
If specified, Pod tolerates any taint that matches the triple <key,value,effect> using the matching operator.
topologySpreadConstraints TopologySpreadConstraint arraySpecifies how to spread matching pods among the given topology.
dnsConfig PodDNSConfigSpecifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy (always ClusterFirst).
More info: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
replicas integer预期实例数。
对于 Core 节点,每个实例都具有稳定的标识。
1Minimum: 0
minReadySeconds integerMinReadySeconds is the minimum time (seconds) a pod must be Ready before it counts as available.
For core nodes this is applied to the StatefulSet (mirrors apps/v1 StatefulSetSpec.minReadySeconds);
for replicants, to the ReplicaSet (mirrors apps/v1 ReplicaSetSpec.minReadySeconds).
Omitted or zero matches the apps/v1 default (0).
Minimum: 0
command string arrayEntrypoint 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. Double $$ are reduced
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. $$(VAR_NAME) will
produce the string literal $(VAR_NAME). Escaped references will never be expanded, regardless
of whether the variable exists or not. Cannot be updated.
More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
Optional: {}
args string arrayArguments 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. Double $$ are reduced
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. $$(VAR_NAME) will
produce the string literal $(VAR_NAME). Escaped references will never be expanded, regardless
of whether the variable exists or not.
More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
ports ContainerPort arrayList of ports to expose from the container.
Exposing a port here gives the system additional information about the network connections a
container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that
port from being exposed. Any port which is listening on the default 0.0.0.0 address inside a
container will be accessible from the network.
Port names dashboard and dashboard-https are reserved by the Operator and cannot be supplied
in the template. The Operator derives these named ports from
spec.config.roots.dashboard.listeners for probes, Services, and per-Pod API requests.
Change their container port by changing the corresponding listener bind instead.
env EnvVar arrayList of environment variables to set in the container.
envFrom EnvFromSource arrayList of sources to populate environment variables from 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.
resources ResourceRequirementsCompute Resources required by this container.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
podSecurityContext PodSecurityContextPod-level security attributes and common container settings.{ fsGroup:1000 fsGroupChangePolicy:Always runAsGroup:1000 runAsNonRoot:true runAsUser:1000 }
containerSecurityContext SecurityContextSecurity options the container should be run with.
If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
initContainers Container arrayList 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, Liveness probes, or Startup 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.
More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
extraContainers Container arrayAdditional containers to run alongside the main container.
extraVolumes Volume arrayAdditional volumes to provide to a Pod.
extraVolumeMounts VolumeMount arraySpecifies how additional volumes are mounted into the main container.
livenessProbe ProbePeriodic probe of container liveness.
Container will be restarted if the probe fails.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
{ failureThreshold:3 httpGet:map[path:/status port:dashboard] initialDelaySeconds:60 periodSeconds:30 }
readinessProbe ProbePeriodic probe of container service readiness.
Container will be removed from service endpoints if the probe fails.
Strongly advised to keep the current default: it takes into account ongoing node evacuations managed
by the Operator as part of scaling operations and rolling updates.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
{ failureThreshold:1 httpGet:map[path:/api/v5/load_rebalance/availability_check port:dashboard] initialDelaySeconds:10 periodSeconds:5 timeoutSeconds:3 }
startupProbe ProbeStartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully.
If this probe fails, the Pod will be restarted, just as if the livenessProbe failed.
This can be used to provide different probe parameters at the beginning of a Pod's lifecycle,
when it might take a long time to load data or warm a cache, than during steady-state operation.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
lifecycle LifecycleActions that the management system should take in response to container lifecycle events.

EMQXSpec ​

EMQXSpec 定义 EMQX 的预期状态。

出现于:

字段说明默认值校验规则
image stringEMQX 容器镜像。
更多信息:https://kubernetes.io/docs/concepts/containers/images
imagePullPolicy PullPolicy容器镜像拉取策略。
可取值为 Always、Never 或 IfNotPresent。
指定 :latest 标签时默认为 Always,否则默认为 IfNotPresent。
更多信息:https://kubernetes.io/docs/concepts/containers/images#updating-images
imagePullSecrets LocalObjectReference arrayImagePullSecrets is an optional 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.
More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
serviceAccountName stringServiceAccount name.
Managed ReplicaSets and StatefulSets are associated with the specified ServiceAccount for authentication purposes.
More info: https://kubernetes.io/docs/concepts/security/service-accounts
config ConfigEMQX 配置。
clusterDomain stringKubernetes 集群域名。cluster.local
revisionHistoryLimit integer为支持回滚而保留的旧 ReplicaSet 数量。3
updateStrategy UpdateStrategy集群升级策略设置。{ type:RollingUpdate }
coreTemplate EMQXCoreTemplate运行 EMQX Core 节点的 Pod 模板。{ spec:map[persistentVolumeClaimSpec:map[accessModes:[ReadWriteOnce] resources:map[requests:map[storage:500Mi]]] replicas:1] }
replicantTemplate EMQXReplicantTemplate运行 EMQX Replicant 节点的 Pod 模板。
dashboardServiceTemplate ServiceTemplate用于公开 EMQX Dashboard 的 Service 模板。
Dashboard Service 始终指向 EMQX Core 节点集。
模板中名为 dashboard 或 dashboard-https 的端口会覆盖对应的自动生成 Service 端口。
可通过 port 在其他 Service 端口上公开监听器,但 targetPort 必须解析到对应的 Dashboard 监听器。
建议使用保留的命名目标端口,使其能够跟随监听器绑定地址的变化。
listenersServiceTemplate ServiceTemplate用于公开已启用 EMQX 监听器的 Service 模板。
如果已启用且存在 Replicant 节点,Listeners Service 将指向 EMQX Replicant 节点集;
否则指向 EMQX Core 节点集。

EMQXStatus ​

EMQXStatus 定义观测到的 EMQX 状态。

出现于:

字段说明默认值校验规则
conditions Condition array表示 EMQX 自定义资源当前状态的条件。
coreReplicas integer观测到的 Core 节点集副本数。
coreSelector string与 Core Pod 匹配的序列化标签选择器。
replicantReplicas integer观测到的 Replicant 节点集 Pod 副本数。
供 scale 子资源使用。
replicantSelector string与 Replicant Pod 匹配的序列化标签选择器。
供 scale 子资源发现 HPA Pod。
coreNodes EMQXNode array集群中各 Core 节点的状态。
coreNodesStatus CoreNodesStatusCore 节点集的汇总状态。
replicantNodes EMQXNode array集群中各 Replicant 节点的状态。
replicantNodesStatus ReplicantNodesStatusReplicant 节点集的汇总状态。
nodeEvacuations NodeEvacuationStatus array集群中正在进行的节点疏散状态。
dsReplication DSReplicationStatusEMQX Durable Storage 复制状态。
config ConfigStatus声明式 EMQX 配置的协调状态。
这些字段仅提供实现信息。请优先使用 ConfigApplied 条件
判断配置的生命周期状态。

EvacuationStrategy ​

出现于:

字段说明默认值校验规则
type EvacuationStrategyType节点疏散策略的类型。NodeEvacuationEnum: [NodeEvacuation Disabled]
connectionEvictionRate integer客户端断开连接速率(每秒数量)。
与 EMQX 节点疏散中的 conn-evict-rate 相同。
1000Minimum: 1
sessionEvictionRate integer会话疏散速率(每秒数量)。
与 EMQX 节点疏散中的 sess-evict-rate 相同。
1000Minimum: 1
waitTakeover integer开始疏散会话前的等待时间(秒)。
与 EMQX 节点疏散中的 wait-takeover 相同。
10Minimum: 0
waitHealthCheck integer节点等待负载均衡器将其从活动后端节点列表中移除的时间(秒)。
与 EMQX 节点疏散中的 wait-health-check 相同。
60Minimum: 0

EvacuationStrategyType ​

底层类型: string

出现于:

字段说明
NodeEvacuation
Disabled

NodeEvacuationStatus ​

出现于:

字段说明默认值校验规则
nodeName string被疏散的节点名称
state string疏散状态
sessionRecipients string array会话接收节点
sessionEvictionRate integer会话疏散速率,单位为会话数/秒。
connectionEvictionRate integer连接疏散速率,单位为连接数/秒。
initialSessions integer此节点的初始会话数
initialConnections integer此节点的初始连接数

ReplicantNodesStatus ​

ReplicantNodesStatus 是 Replicant 节点集的汇总状态。 多 ReplicaSet 模式要求在 CR 级别跟踪修订版本。

出现于:

字段说明默认值校验规则
readyReplicas integerReady 副本数。
currentRevision stringReplicant 节点集的当前修订版本。
currentReplicas integer运行当前修订版本的副本数。
updateRevision stringReplicant 节点集的更新修订版本。
如果与当前修订版本不同,表示正在更新该节点集。
updateReplicas integer运行更新修订版本的副本数。
collisionCount integer

ReplicantsUpdateStrategy ​

ReplicantsUpdateStrategy 控制 Replicant ReplicaSet 的发布速度。 其语义与 apps/v1 Deployment.spec.strategy.rollingUpdate 一致。

出现于:

字段说明默认值校验规则
maxUnavailable IntOrStringReplicant ReplicaSet 发布期间,允许同时排空(正在疏散、终止或标记为删除)的旧 Replicant Pod 最大数量。
整数表示绝对数量;字符串表示预期 Replicant 副本数的百分比,例如 "25%"。
默认值为 1,即逐个排空。
XIntOrString: {}
maxSurge IntOrString模板发布期间,新 ReplicaSet 中允许超出预期副本数的额外 Replicant Pod 数量。
整数表示绝对数量;字符串表示预期副本数的百分比。默认值为 0。
XIntOrString: {}

ServiceTemplate ​

出现于:

字段说明默认值校验规则
enabled boolean是否创建此 Service。true
metadata TemplateObjectMeta应用于此模板所生成对象的元数据。
spec ServiceSpecService 的预期状态规格。
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

TemplateObjectMeta ​

TemplateObjectMeta 包含要传播到模板所创建对象的元数据。

出现于:

字段说明默认值校验规则
labels object (keys:string, values:string)应用于所生成对象的标签。
annotations object (keys:string, values:string)应用于所生成对象的注解。

UpdateStrategy ​

出现于:

字段说明默认值校验规则
type string确定集群升级的执行方式。
* RollingUpdate:通过逐步更新 Pod 来执行滚动升级;Core Pod 始终逐个更新,
Replicant 的更新由 replicants 策略控制。
RollingUpdateEnum: [RollingUpdate]
evacuationStrategy EvacuationStrategy节点疏散策略设置。{ type:NodeEvacuation }
replicants ReplicantsUpdateStrategyReplicant ReplicaSet 滚动更新的参数。