7.2. 创建 Data Grid 服务 pod


要使用自定义缓存定义以及 Data Grid 功能(如跨站点复制),请创建 Data Grid 服务 pod 的集群。

流程

  1. 创建一个 Infinispan CR,以设置 spec.service.type: DataGrid 并配置任何其他 Data Grid 服务资源。

    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: infinispan
    spec:
      replicas: 2
      version: <Data Grid_version>
      service:
        type: DataGrid
    Copy to Clipboard Toggle word wrap
    重要

    在创建 pod 后,您无法更改 spec.service.type 字段。要更改服务类型,您必须删除现有 pod 并创建新的 pod。

  2. 应用 Infinispan CR 以创建集群。

7.2.1. Data Grid 服务 CR

本主题描述了 Data Grid 服务 pod 的 Infinispan CR。

apiVersion: infinispan.org/v1
kind: Infinispan
metadata:
  name: infinispan
  annotations:
    infinispan.org/monitoring: 'true'
spec:
  replicas: 6
  version: 8.4.6-1
  upgrades:
    type: Shutdown
  service:
    type: DataGrid
    container:
      storage: 2Gi
      # The ephemeralStorage and storageClassName fields are mutually exclusive.
      ephemeralStorage: false
      storageClassName: my-storage-class
    sites:
      local:
      name: azure
      expose:
        type: LoadBalancer
      locations:
      - name: azure
        url: openshift://api.azure.host:6443
        secretName: azure-token
      - name: aws
        clusterName: infinispan
        namespace: rhdg-namespace
        url: openshift://api.aws.host:6443
        secretName: aws-token
  security:
    endpointSecretName: endpoint-identities
    endpointEncryption:
        type: Secret
        certSecretName: tls-secret
  container:
    extraJvmOpts: "-XX:NativeMemoryTracking=summary"
    cpu: "2000m:1000m"
    memory: "2Gi:1Gi"
  logging:
    categories:
      org.infinispan: debug
      org.jgroups: debug
      org.jgroups.protocols.TCP: error
      org.jgroups.protocols.relay.RELAY2: error
  expose:
    type: LoadBalancer
  configMapName: "my-cluster-config"
  configListener:
    enabled: true
  affinity:
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchLabels:
              app: infinispan-pod
              clusterName: infinispan
              infinispan_cr: infinispan
          topologyKey: "kubernetes.io/hostname"
Copy to Clipboard Toggle word wrap
Expand
字段描述

metadata.name

命名您的数据网格集群。

metadata.annotations.infinispan.org/monitoring

为集群自动创建 ServiceMonitor

spec.replicas

指定集群中的 pod 数量。

spec.version

指定集群的 Data Grid Server 版本。

spec.upgrades.type

控制在新版本可用时 Data Grid Operator 如何升级您的 Data Grid 集群。

spec.service.type

配置类型 Data Grid 服务。DataGrid 的值为 DataGrid 创建一个具有 Data Grid 服务 pod 的集群。

spec.service.container

为 Data Grid 服务 pod 配置存储资源。

spec.service.sites

配置跨站点复制。

spec.security.endpointSecretName

指定包含 Data Grid 用户凭证的身份验证 secret。

spec.security.endpointEncryption

指定 TLS 证书和密钥存储来加密客户端连接。

spec.container

指定 Data Grid pod 的 JVM、CPU 和内存资源。

spec.logging

配置 Data Grid 日志记录类别。

spec.expose

控制如何在网络上公开数据网格端点。

spec.configMapName

指定包含 Data Grid 配置的 ConfigMap

spec.configListener.enabled

在每个 Data Grid 集群中创建一个 监听器 pod,它允许 Data Grid Operator 与 Data Grid 资源(如 Cache CR)协调服务器端修改。

侦听器 pod 使用最少的资源,并默认启用。设置 false 会删除 监听程序 pod 并禁用双向协调。只有在不需要通过 Data Grid Console、CLI 或客户端应用程序创建的 Data Grid 资源声明 Kubernetes 时,才应执行此操作。

spec.configListener.logging.level

配置 ConfigListener 部署配置的日志级别。默认级别是 info。您可以将其更改为 debugerror

spec.affinity

配置反关联性策略,以保证数据网格可用性。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat