helm使用NodePort方式配置mongo集群

508 阅读1分钟
配置文件 values-nodeport.yaml 

global:
# 定义 storageClass 使用的类型
storageClass: "rook-ceph-block"

# 定义 mongodb 集群为副本集模式
architecture: replicaset

# 启动集群认证功能,设置超级管理员账户密码
auth:
enabled: true
rootUser: root
rootPassword: "root"

# 设置集群数量,3个
replicaCount: 3

externalAccess:
enabled: true
service:
 type: NodePort
 nodePorts: ["30001", "30002", "30003"]
serviceAccount:
create: true
rbac:
create: true
# 启用持久化存储,使用 global.storageClass 自动创建 pvc 
persistence:
enabled: true
size: 2Gi

# service  ip
service:
annotations: {}
type: loadBalancer
# clusterIP: None
port: 27017

root@node1:~# kubectl get services
NAME                               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)           AGE
kubernetes                         ClusterIP   10.96.0.1       <none>        443/TCP           26h
mongodb-cluster-0-external         NodePort    10.108.100.58   <none>        27017:30001/TCP   2m20s
mongodb-cluster-1-external         NodePort    10.107.31.139   <none>        27017:30002/TCP   2m20s
mongodb-cluster-2-external         NodePort    10.96.114.91    <none>        27017:30003/TCP   2m20s
mongodb-cluster-arbiter-headless   ClusterIP   None            <none>        27017/TCP         2m20s
mongodb-cluster-headless           ClusterIP   None            <none>        27017/TCP         2m20s