3.3. 创建缓存服务 pod
使用缓存服务 pod 创建 Data Grid 集群,用于带有最小配置的易失性低延迟数据存储。
流程
创建一个
InfinispanCR,以设置spec.service.type: Cache并配置任何其他缓存服务资源。apiVersion: infinispan.org/v1 kind: Infinispan metadata: name: example-infinispan spec: replicas: 2 service: type: Cache-
应用
InfinispanCR 以创建集群。
3.3.1. 缓存服务 CR 复制链接链接已复制到粘贴板!
本主题描述了 Cache 服务 pod 的 Infinispan CR。
apiVersion: infinispan.org/v1
kind: Infinispan
metadata:
name: example-infinispan
annotations:
infinispan.org/monitoring: 'true'
spec:
replicas: 2
service:
type: Cache
replicationFactor: 2
autoscale:
maxMemUsagePercent: 70
maxReplicas: 5
minMemUsagePercent: 30
minReplicas: 2
security:
endpointSecretName: endpoint-identities
endpointEncryption:
type: Secret
certSecretName: tls-secret
container:
extraJvmOpts: "-XX:NativeMemoryTracking=summary"
cpu: "2000m"
memory: 1Gi
logging:
categories:
org.infinispan: trace
org.jgroups: trace
expose:
type: LoadBalancer
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app: infinispan-pod
clusterName: example-infinispan
infinispan_cr: example-infinispan
topologyKey: "kubernetes.io/hostname"
| 字段 | 描述 |
|---|---|
|
| 命名您的数据网格集群。 |
|
|
为集群自动创建 |
|
| 指定集群中的 pod 数量。如果启用自动扩展功能,此字段指定 pod 的初始数量。 |
|
|
配置类型 Data Grid 服务。 |
|
| 设置集群中每个条目的副本数。Cache 服务 pod 的默认值为两个,它会复制每个缓存条目以避免数据丢失。 |
|
| 启用并配置自动扩展。 |
|
| 指定包含 Data Grid 用户凭证的身份验证 secret。 |
|
| 指定 TLS 证书和密钥存储来加密客户端连接。 |
|
| 指定 Data Grid pod 的 JVM、CPU 和内存资源。 |
|
| 配置 Data Grid 日志记录类别。 |
|
| 控制如何在网络上公开数据网格端点。 |
|
| 配置反关联性策略,以保证数据网格可用性。 |