k8s部署mongodb-sharded7.X集群(多副本集)

#mongodb-sharded 7.X版本

CHART NAME: mongodb-sharded
CHART VERSION: 7.0.5
APP VERSION: 7.0.2
helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull  bitnami/bitnami/mongodb-sharded --untar

默认副本数较多。我修改为3+3

k8s部署mongodb-sharded7.X集群(多副本集)_第1张图片

搜索关键字replicaCount 修改

在这里插入图片描述

最后安装

helm  install mongodb-sharded mongodb-sharded -f ./mongodb-sharded/values.yaml

再分享一个web客户端

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-express
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-express
  template:
    metadata:
      labels:
        app: mongo-express
    spec:
      containers:
      - name: mongo-express
        image: mongo-express:latest
        ports:
        - containerPort: 8081
        env:
        - name: ME_CONFIG_MONGODB_URL
          value: mongodb://root:123000@mongodb-sharded.openim-dev.svc:27017/admin?ssl=false
        - name: ME_CONFIG_MONGODB_AUTH_USERNAME
          value: "admin"
        - name: ME_CONFIG_MONGODB_AUTH_PASSWORD
          value: "123qwe"

---
apiVersion: v1
kind: Service
metadata:
  name: mongo-express
spec:
  type: NodePort
  selector:
    app: mongo-express
  ports:
  - port: 80
    targetPort: 8081

k8s部署mongodb-sharded7.X集群(多副本集)_第2张图片

你可能感兴趣的:(存储,k8s,kubernetes,mongodb,容器)