Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] support setting the cluster username and password when create the Elasticsearch cluster #1062

Open
shuoshadow opened this issue Sep 25, 2024 · 0 comments
Assignees

Comments

@shuoshadow
Copy link

Using environment variables to set it would be convenient, or other more secure methods.

Here is an example:

apiVersion: v1
kind: Secret
metadata:
  name: elastic-credentials
  namespace: kb-cloud
type: Opaque
stringData:
  username: elastic
  password: vYxdfazdfIJnnKas
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  annotations:
    kubeblocks.io/extra-env: '{"mdit-roles":"master,data,ingest,transform","mode":"multi-node"}'
  labels:
    app.kubernetes.io/instance: dev-es
    app.kubernetes.io/version: 7.10.1
    helm.sh/chart: elasticsearch-cluster-0.9.0
  name: dev-es
  namespace: kb-cloud
spec:
  tolerations:
    - key: "node-type"
      operator: "Equal"
      value: "mid"
      effect: "NoSchedule"
  affinity:
    podAntiAffinity: Required
    tenancy: SharedNode
    #topologyKeys:
    #- kubernetes.io/hostname
    nodeLabels:
      node-type: "mid"
  componentSpecs:
    - componentDef: elasticsearch-7
      disableExporter: false
      env:
        - name: ELASTIC_USERNAME
          valueFrom:
            secretKeyRef:
              name: elastic-credentials
              key: username
        - name: ELASTIC_PASSWORD
          valueFrom:
            secretKeyRef:
              name: elastic-credentials
              key: password
      name: mdit
      replicas: 3
      resources:
        limits:
          cpu: "4"
          memory: 8Gi
        requests:
          cpu: "4"
          memory: 8Gi
      serviceAccountName: null
      serviceVersion: 7.10.1
      services: null
      systemAccounts:
      - name: elastic
      volumeClaimTemplates:
      - name: data
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 500Gi
          storageClassName: openebs-hostpath
  terminationPolicy: Delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants