7.2. 创建 Data Grid 服务 pod
要使用自定义缓存定义以及 Data Grid 功能(如跨站点复制),请创建 Data Grid 服务 pod 的集群。
流程
创建一个
InfinispanCR,以设置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重要在创建 pod 后,您无法更改
spec.service.type字段。要更改服务类型,您必须删除现有 pod 并创建新的 pod。-
应用
InfinispanCR 以创建集群。
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"
| 字段 | 描述 |
|---|---|
|
| 命名您的数据网格集群。 |
|
|
为集群自动创建 |
|
| 指定集群中的 pod 数量。 |
|
| 指定集群的 Data Grid Server 版本。 |
|
| 控制在新版本可用时 Data Grid Operator 如何升级您的 Data Grid 集群。 |
|
|
配置类型 Data Grid 服务。DataGrid 的值为 |
|
| 为 Data Grid 服务 pod 配置存储资源。 |
|
| 配置跨站点复制。 |
|
| 指定包含 Data Grid 用户凭证的身份验证 secret。 |
|
| 指定 TLS 证书和密钥存储来加密客户端连接。 |
|
| 指定 Data Grid pod 的 JVM、CPU 和内存资源。 |
|
| 配置 Data Grid 日志记录类别。 |
|
| 控制如何在网络上公开数据网格端点。 |
|
|
指定包含 Data Grid 配置的 |
|
|
在每个 Data Grid 集群中创建一个
|
|
|
配置 |
|
| 配置反关联性策略,以保证数据网格可用性。 |