charts icon indicating copy to clipboard operation
charts copied to clipboard

[Bitnami/Mongodb] Starting MongoDB in background

Open fdarif opened this issue 5 years ago • 8 comments

Which chart: The name (and mongodb-10.26.3) of the affected chart

Describe the bug mongodb & arbiter pods exit at Starting MongoDB in background... step

error

mongodb 13:54:40.43 INFO  ==> Validating settings in MONGODB_* env vars...
mongodb 13:54:40.73 INFO  ==> Initializing MongoDB...
mongodb 13:54:41.33 INFO  ==> Deploying MongoDB from scratch...
mongodb 13:54:41.44 DEBUG ==> Starting MongoDB in background...
about to fork child process, waiting until server is ready for connections.
forked process: 40
ERROR: child process failed, exited with 1
To see additional information in this output, start without the "--fork" option.

Version of Helm and Kubernetes:

$ kubectl version --short && helm version --short
Client Version: v1.21.1
Server Version: v1.21.0
v3.6.2+gee407bd

values yaml file used

global:
  imageRegistry: ""
  imagePullSecrets: []
  storageClass: ""
  namespaceOverride: "demo"


nameOverride: ""
fullnameOverride: ""
clusterDomain: cluster.local
commonLabels: {}
commonAnnotations: {}

diagnosticMode:
  enabled: false
  command:
    - sleep
  args:
    - infinity


image:
  registry: docker.io
  repository: bitnami/mongodb
  tag: 4.4.9-debian-10-r0
  pullPolicy: IfNotPresent
  pullSecrets: []
  debug: true

schedulerName: ""
architecture: replicaset
useStatefulSet: false
auth:
  enabled: true
  rootUser: root
  rootPassword: ""
  username: ""
  password: ""
  database: ""
  replicaSetKey: ""
  existingSecret: "mongodb-secret"
tls:
  enabled: true
  autoGenerated: true
  existingSecret: ""
  caCert: ""
  caKey: ""
  image:
    registry: docker.io
    repository: bitnami/nginx
    tag: 1.21.3-debian-10-r11
    pullPolicy: IfNotPresent
hostAliases: []
replicaSetName: rs0
replicaSetHostnames: true
enableIPv6: false
directoryPerDB: false
systemLogVerbosity: 0
disableSystemLog: false
disableJavascript: false
enableJournal: true
configuration: |-
  storage:
     dbPath: /opt/mongo/demo/data/db
     journal:
       enabled: true
     directoryPerDB: false
  systemLog:
     destination: file
     quiet: false
     logAppend: true
     logRotate: reopen
     path: /var/mongo/demo/mongodb.log
     verbosity: 0
  net:
     port: 27017
     unixDomainSocket:
       enabled: true
       pathPrefix: /tmp
       filePermissions: 0700
     ipv6: false
     bindIpAll: true
  processManagement:
     timeZoneInfo: Europe/Paris 
  
existingConfigmap: ""
initdbScripts: {}
initdbScriptsConfigMap: ""
command: []
args: []
extraFlags: []
extraEnvVars:
- name: TZ
  value: Europe/Paris
extraEnvVarsCM: ""
extraEnvVarsSecret: ""


annotations: {}
labels: {}
replicaCount: 3
strategyType: RollingUpdate
podManagementPolicy: OrderedReady
podAffinityPreset: ""
podAntiAffinityPreset: soft
nodeAffinityPreset:
  type: ""
  key: ""
  values: []
affinity: {}
nodeSelector: {}
tolerations: []
podLabels: {}
podAnnotations: {}
priorityClassName: ""
runtimeClassName: ""
podSecurityContext:
  enabled: true
  fsGroup: 1002
  sysctls: []
containerSecurityContext:
  enabled: true
  runAsUser: 1002
  runAsNonRoot: true
resources:
  limits:
    cpu: 1.5
    memory: 2Gi
  requests: 
    cpu: 500m
    memory: 256Mi
livenessProbe:
  enabled: true
  initialDelaySeconds: 30
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 6
  successThreshold: 1
readinessProbe:
  enabled: true
  initialDelaySeconds: 5
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 6
  successThreshold: 1
startupProbe:
  enabled: false
  initialDelaySeconds: 5
  periodSeconds: 10
  timeoutSeconds: 5
  successThreshold: 1
  failureThreshold: 30
customLivenessProbe: {}
customReadinessProbe: {}
customStartupProbe: {}
initContainers: []
sidecars: []
extraVolumeMounts: []
extraVolumes: []
pdb:
  create: false
  minAvailable: 1
  maxUnavailable: ""


service:
  nameOverride: ""
  type: ClusterIP
  port: 27017
  portName: mongodb
  nodePort: ""
  clusterIP: ""
  externalIPs: []
  loadBalancerIP: ""
  loadBalancerSourceRanges: []
  annotations: {}
externalAccess:
  enabled: false
  autoDiscovery:
    enabled: false
    image:
      registry: docker.io
      repository: bitnami/kubectl
      tag: 1.19.15-debian-10-r2
      pullPolicy: IfNotPresent
      pullSecrets: []
    resources:
      limits: {}
      requests: {}
  service:
    type: NodePort
    port: 27017
    loadBalancerIPs: []
    loadBalancerSourceRanges: []
    nodePorts:
        - 30001
        - 30002
        - 30003
    domain: ""
    annotations: {}
  hidden:
    enabled: false
    service:
      type: LoadBalancer
      port: 27017
      loadBalancerIPs: []
      loadBalancerSourceRanges: []
      nodePorts: []
      domain: ""
      annotations: {}


persistence:
  enabled: true
  existingClaim: ""
  storageClass: "local-path"
  accessModes:
    - ReadWriteOnce
  size: 200Gi
  annotations: {}
  mountPath: /opt/mongodb/demo/data/db
  subPath: ""
  volumeClaimTemplates:
    selector: {}
    requests: {}
    dataSource: {}


serviceAccount:
  create: true
  name: "mongodb-sa"
  annotations: {}
rbac:
  create: false
  role:
    rules: []
podSecurityPolicy:
  create: false
  allowPrivilegeEscalation: false
  privileged: false
  spec: {}


volumePermissions:
  enabled: true
  image:
    registry: docker.io
    repository: bitnami/bitnami-shell
    tag: 10-debian-10-r197
    pullPolicy: Always
    pullSecrets: []
  resources:
    limits:
      cpu: 500m
      memory: 512Mi
    requests:
       cpu: 100m
       memory: 128Mi
  securityContext:
    runAsUser: 0


arbiter:
  enabled: true
  configuration: ""
  hostAliases: []
  existingConfigmap: ""
  command: []
  args: []
  extraFlags: []
  extraEnvVars:
   - name: TZ
     value: Europe/Paris
  extraEnvVarsCM: ""
  extraEnvVarsSecret: ""
  annotations: {}
  labels: {}
  podAffinityPreset: ""
  podAntiAffinityPreset: soft
  nodeAffinityPreset:
    type: ""
    key: ""
    values: []
  affinity: {}
  nodeSelector: {}
  tolerations: []
  podLabels: {}
  podAnnotations: {}
  priorityClassName: ""
  runtimeClassName: ""
  podSecurityContext:
    enabled: true
    fsGroup: 1002
    sysctls: []
  containerSecurityContext:
    enabled: true
    runAsUser: 1002
  resources:
    limits:
        cpu: 100m
        memory: 128Mi
    requests:
        cpu: 100m
        memory: 128Mi
  livenessProbe:
    enabled: true
    initialDelaySeconds: 30
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 6
    successThreshold: 1
  readinessProbe:
    enabled: true
    initialDelaySeconds: 5
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 6
    successThreshold: 1
  customLivenessProbe: {}
  customReadinessProbe: {}
  initContainers: []
  sidecars: []
  extraVolumeMounts: []
  extraVolumes: []
  pdb:
    create: false
    minAvailable: 1
    maxUnavailable: ""
  service:
    nameOverride: ""


hidden:
  enabled: false
  configuration: ""
  existingConfigmap: ""
  command: []
  args: []
  extraFlags: []
  extraEnvVars: []
  extraEnvVarsCM: ""
  extraEnvVarsSecret: ""
  annotations: {}
  labels: {}
  replicaCount: 1
  strategyType: RollingUpdate
  podManagementPolicy: OrderedReady
  podAffinityPreset: ""
  podAntiAffinityPreset: soft
  nodeAffinityPreset:
    type: ""
    key: ""
    values: []
  affinity: {}
  nodeSelector: {}
  tolerations: []
  podLabels: {}
  podAnnotations: {}
  priorityClassName: ""
  runtimeClassName: ""
  resources:
    limits: {}
    requests: {}
  livenessProbe:
    enabled: true
    initialDelaySeconds: 30
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 6
    successThreshold: 1
  readinessProbe:
    enabled: true
    initialDelaySeconds: 5
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 6
    successThreshold: 1
  customLivenessProbe: {}
  customReadinessProbe: {}
  initContainers: []
  sidecars: []
  extraVolumeMounts: []
  extraVolumes: []
  pdb:
    create: false
    minAvailable: 1
    maxUnavailable: ""
  persistence:
    enabled: true
    storageClass: ""
    accessModes:
      - ReadWriteOnce
    size: 8Gi
    annotations: {}
    mountPath: /bitnami/mongodb
    subPath: ""
    volumeClaimTemplates:
      selector: {}
      dataSource: {}


metrics:
  enabled: true
  image:
    registry: docker.io
    repository: bitnami/mongodb-exporter
    tag: 0.11.2-debian-10-r284
    pullPolicy: IfNotPresent
    pullSecrets: []

  username: ""
  password: ""
  extraFlags: ""
  extraUri: ""
  resources:
    limits:
       cpu: 100m
       memory: 128Mi
    requests:
       cpu: 100m
       memory: 128Mi
  containerPort: 9216
  service:
    annotations:
      prometheus.io/scrape: "true"
      prometheus.io/port: "{{ .Values.metrics.service.port }}"
      prometheus.io/path: "/metrics"
    type: ClusterIP
    port: 9216
  livenessProbe:
    enabled: true
    initialDelaySeconds: 15
    periodSeconds: 5
    timeoutSeconds: 5
    failureThreshold: 3
    successThreshold: 1
  readinessProbe:
    enabled: true
    initialDelaySeconds: 5
    periodSeconds: 5
    timeoutSeconds: 1
    failureThreshold: 3
    successThreshold: 1
  serviceMonitor:
    enabled: true
    namespace: "demo"
    interval: 30s
    scrapeTimeout: 30s
    relabellings: []
    metricRelabelings: []
    additionalLabels: {}
  prometheusRule:
    enabled: true
    additionalLabels: {}
    namespace: "demo"
    rules:
     - name: HighRequestLatency
       rules:
       - alert: HighRequestLatency
         expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
         for: 10m
         labels:
           severity: page
         annotations:
           summary: High request latency
```

fdarif avatar Oct 19 '21 12:10 fdarif

Hi @fayssaldarif , Could you please provide the describe of the pods and also the output of helm get values <release-name> please?

miguelaeh avatar Oct 20 '21 08:10 miguelaeh

Hi @miguelaeh kubectl describe pod -n demo fa-mongodb-0

Name:         fa-mongodb-0
Namespace:    demo
Priority:     0
Node:         selenium03.france-atelier.fr/54.38.46.127
Start Time:   Thu, 21 Oct 2021 10:02:16 +0200
Labels:       app.kubernetes.io/component=mongodb
             app.kubernetes.io/instance=fa-mongodb
             app.kubernetes.io/managed-by=Helm
             app.kubernetes.io/name=mongodb
             controller-revision-hash=fa-mongodb-86cbf8c776
             helm.sh/chart=mongodb-10.26.3
             statefulset.kubernetes.io/pod-name=fa-mongodb-0
Annotations:  checksum/configuration: 1207180f2bc95382e38e7bda4d8e988c8c7f27c44e1a72a037681d357c32a5ce
             cni.projectcalico.org/podIP: 10.244.20.215/32
             cni.projectcalico.org/podIPs: 10.244.20.215/32
Status:       Running
IP:           10.244.20.215
IPs:
 IP:           10.244.20.215
Controlled By:  StatefulSet/fa-mongodb
Init Containers:
 volume-permissions:
   Container ID:  docker://03f6eb901152db3eac77c9d9fb4bbb0286d1199629ae640220b877f34937455f
   Image:         docker.io/bitnami/bitnami-shell:10-debian-10-r197
   Image ID:      docker-pullable://bitnami/bitnami-shell@sha256:a54eee9ca09b66f3d6568e062c4f99dc78e47ce96b203262afe3d6ca37534e43
   Port:          <none>
   Host Port:     <none>
   Command:
     /bin/bash
     -ec
   Args:
     mkdir -p /opt/mongodb/demo/data/db
     chown -R "1002:1002" "/opt/mongodb/demo/data/db"

   State:          Terminated
     Reason:       Completed
     Exit Code:    0
     Started:      Thu, 21 Oct 2021 10:02:19 +0200
     Finished:     Thu, 21 Oct 2021 10:02:19 +0200
   Ready:          True
   Restart Count:  0
   Limits:
     cpu:     500m
     memory:  512Mi
   Requests:
     cpu:        100m
     memory:     128Mi
   Environment:  <none>
   Mounts:
     /opt/mongodb/demo/data/db from datadir (rw)
     /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dwmsl (ro)
 generate-tls-certs:
   Container ID:  docker://7186b19e6a4c09cf391efb415750ab15c77349588f395385203ff832b1224e89
   Image:         docker.io/bitnami/nginx:1.21.3-debian-10-r11
   Image ID:      docker-pullable://bitnami/nginx@sha256:603821233cc6c4fa477d4dcce91db6b9a2629804fa05de1e8ecd9312d4e4c796
   Port:          <none>
   Host Port:     <none>
   Command:
     sh
     -c
     /bin/bash <<'EOF'
     my_hostname=$(hostname)
     svc=$(echo -n "$my_hostname" | sed s/-[0-9]*$//)-headless
     cp /certs/CAs/* /certs/
     cat >/certs/openssl.cnf <<EOL
     [req]
     req_extensions = v3_req
     distinguished_name = req_distinguished_name
     [req_distinguished_name]
     [ v3_req ]
     basicConstraints = CA:FALSE
     keyUsage = nonRepudiation, digitalSignature, keyEncipherment
     subjectAltName = @alt_names
     [alt_names]
     DNS.1 = $svc
     DNS.2 = $my_hostname
     DNS.3 = $my_hostname.$svc.$MY_POD_NAMESPACE.svc.cluster.local
     DNS.4 = localhost
     DNS.5 = 127.0.0.1
     EOL

     export RANDFILE=/certs/.rnd && openssl genrsa -out /certs/mongo.key 2048
     #Create the client/server certificate
     openssl req -new -key /certs/mongo.key -out /certs/mongo.csr -subj "/C=US/O=My Organisations/OU=IT/CN=$my_hostname" -config /certs/openssl.cnf
     #Signing the server certificate with the CA cert and key
     openssl x509 -req -in /certs/mongo.csr -CA /certs/mongodb-ca-cert -CAkey /certs/mongodb-ca-key -CAcreateserial -out /certs/mongo.crt -days 3650 -extensions v3_req -extfile /certs/openssl.cnf
     rm /certs/mongo.csr
     #Concatenate to a pem file for use as the client PEM file which can be used for both member and client authentication.
     cat /certs/mongo.crt /certs/mongo.key > /certs/mongodb.pem
     cd /certs/
     shopt -s extglob
     rm -rf !(mongodb-ca-cert|mongodb.pem|CAs|openssl.cnf)
     chmod 0600 mongodb-ca-cert mongodb.pem
     EOF

   State:          Terminated
     Reason:       Completed
     Exit Code:    0
     Started:      Thu, 21 Oct 2021 10:02:19 +0200
     Finished:     Thu, 21 Oct 2021 10:02:19 +0200
   Ready:          True
   Restart Count:  0
   Environment:
     MY_POD_NAMESPACE:  demo (v1:metadata.namespace)
   Mounts:
     /certs from certs (rw)
     /certs/CAs from certs-volume (rw)
     /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dwmsl (ro)
Containers:
 mongodb:
   Container ID:  docker://2d18f1296d0611b1530427c1a589e2b00476bf2ad5e2fa54b6fa13a2860ea473
   Image:         docker.io/bitnami/mongodb:4.4.9-debian-10-r0
   Image ID:      docker-pullable://bitnami/mongodb@sha256:a812b4ad0c94585221449ae5c904dd9dea35fedfa5b31f2a5992c0a3c4c59f58
   Port:          27017/TCP
   Host Port:     0/TCP
   Command:
     /scripts/setup.sh
   State:          Waiting
     Reason:       CrashLoopBackOff
   Last State:     Terminated
     Reason:       Error
     Exit Code:    1
     Started:      Thu, 21 Oct 2021 10:02:41 +0200
     Finished:     Thu, 21 Oct 2021 10:02:41 +0200
   Ready:          False
   Restart Count:  2
   Limits:
     cpu:     1500m
     memory:  2Gi
   Requests:
     cpu:      500m
     memory:   256Mi
   Liveness:   exec [mongo --disableImplicitSessions --tls --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert --eval db.adminCommand('ping')] delay=30s timeout=5s period=10s #success=1 #failure=6
   Readiness:  exec [bash -ec TLS_OPTIONS='--tls --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert'
# Run the proper check depending on the version
[[ $(mongo --version | grep "MongoDB shell") =~ ([0-9]+\.[0-9]+\.[0-9]+) ]] && VERSION=${BASH_REMATCH[1]}
. /opt/bitnami/scripts/libversion.sh
VERSION_MAJOR="$(get_sematic_version "$VERSION" 1)"
VERSION_MINOR="$(get_sematic_version "$VERSION" 2)"
VERSION_PATCH="$(get_sematic_version "$VERSION" 3)"
if [[ "$VERSION_MAJOR" -ge 4 ]] && [[ "$VERSION_MINOR" -ge 4 ]] && [[ "$VERSION_PATCH" -ge 2 ]]; then
   mongo --disableImplicitSessions $TLS_OPTIONS --eval 'db.hello().isWritablePrimary || db.hello().secondary' | grep -q 'true'
else
   mongo --disableImplicitSessions $TLS_OPTIONS --eval 'db.isMaster().ismaster || db.isMaster().secondary' | grep -q 'true'
fi
] delay=5s timeout=5s period=10s #success=1 #failure=6
   Environment:
     BITNAMI_DEBUG:                    true
     MY_POD_NAME:                      fa-mongodb-0 (v1:metadata.name)
     MY_POD_NAMESPACE:                 demo (v1:metadata.namespace)
     K8S_SERVICE_NAME:                 fa-mongodb-headless
     MONGODB_INITIAL_PRIMARY_HOST:     fa-mongodb-0.$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
     MONGODB_REPLICA_SET_NAME:         rs0
     MONGODB_ADVERTISED_HOSTNAME:      $(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
     MONGODB_ROOT_USER:                root
     MONGODB_ROOT_PASSWORD:            <set to the key 'mongodb-root-password' in secret 'mongodb-secret'>    Optional: false
     MONGODB_REPLICA_SET_KEY:          <set to the key 'mongodb-replica-set-key' in secret 'mongodb-secret'>  Optional: false
     ALLOW_EMPTY_PASSWORD:             no
     MONGODB_SYSTEM_LOG_VERBOSITY:     0
     MONGODB_DISABLE_SYSTEM_LOG:       no
     MONGODB_DISABLE_JAVASCRIPT:       no
     MONGODB_ENABLE_JOURNAL:           yes
     MONGODB_ENABLE_IPV6:              no
     MONGODB_ENABLE_DIRECTORY_PER_DB:  no
     MONGODB_EXTRA_FLAGS:              --tlsMode=requireTLS --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert
     MONGODB_CLIENT_EXTRA_FLAGS:       --tls --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert
     TZ:                               Europe/Paris
   Mounts:
     /certs from certs (rw)
     /opt/bitnami/mongodb/conf/mongodb.conf from config (rw,path="mongodb.conf")
     /opt/mongodb/demo/data/db from datadir (rw)
     /scripts/setup.sh from scripts (rw,path="setup.sh")
     /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dwmsl (ro)
 metrics:
   Container ID:  docker://958ad7f22fe5f4b10a7adaec7c9ef9bacf6198ef35d3bb9ee05c5378eb16ff65
   Image:         docker.io/bitnami/mongodb-exporter:0.11.2-debian-10-r284
   Image ID:      docker-pullable://bitnami/mongodb-exporter@sha256:c5e33b92527486b2103476475b9b61b1f7803e8eea35aaa80dc73bd42a696aad
   Port:          9216/TCP
   Host Port:     0/TCP
   Command:
     /bin/bash
     -ec
   Args:
     /bin/mongodb_exporter --web.listen-address ":9216" --mongodb.uri "mongodb://$MONGODB_ROOT_USER:$(echo $MONGODB_ROOT_PASSWORD | sed -r "s/@/%40/g;s/:/%3A/g")@localhost:27017/admin?tls=true&tlsCertificateKeyFile=/certs/mongodb.pem&tlsCAFile=/certs/mongodb-ca-cert"

   State:          Running
     Started:      Thu, 21 Oct 2021 10:02:21 +0200
   Ready:          True
   Restart Count:  0
   Limits:
     cpu:     100m
     memory:  128Mi
   Requests:
     cpu:      100m
     memory:   128Mi
   Liveness:   http-get http://:metrics/ delay=15s timeout=5s period=5s #success=1 #failure=3
   Readiness:  http-get http://:metrics/ delay=5s timeout=1s period=5s #success=1 #failure=3
   Environment:
     MONGODB_ROOT_USER:      root
     MONGODB_ROOT_PASSWORD:  <set to the key 'mongodb-root-password' in secret 'mongodb-secret'>  Optional: false
   Mounts:
     /certs from certs (rw)
     /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dwmsl (ro)
Conditions:
 Type              Status
 Initialized       True
 Ready             False
 ContainersReady   False
 PodScheduled      True
Volumes:
 datadir:
   Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
   ClaimName:  datadir-fa-mongodb-0
   ReadOnly:   false
 config:
   Type:      ConfigMap (a volume populated by a ConfigMap)
   Name:      fa-mongodb
   Optional:  false
 scripts:
   Type:      ConfigMap (a volume populated by a ConfigMap)
   Name:      fa-mongodb-scripts
   Optional:  false
 certs:
   Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
   Medium:
   SizeLimit:  <unset>
 certs-volume:
   Type:        Secret (a volume populated by a Secret)
   SecretName:  fa-mongodb-ca
   Optional:    false
 kube-api-access-dwmsl:
   Type:                    Projected (a volume that contains injected data from multiple sources)
   TokenExpirationSeconds:  3607
   ConfigMapName:           kube-root-ca.crt
   ConfigMapOptional:       <nil>
   DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                            node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
 Type     Reason     Age                From               Message
 ----     ------     ----               ----               -------
 Normal   Scheduled  43s                default-scheduler  Successfully assigned demo/fa-mongodb-0 to selenium03.france-atelier.fr
 Normal   Pulling    43s                kubelet            Pulling image "docker.io/bitnami/bitnami-shell:10-debian-10-r197"
 Normal   Pulled     42s                kubelet            Successfully pulled image "docker.io/bitnami/bitnami-shell:10-debian-10-r197" in 1.160901276s
 Normal   Created    42s                kubelet            Created container volume-permissions
 Normal   Started    41s                kubelet            Started container volume-permissions
 Normal   Pulled     41s                kubelet            Container image "docker.io/bitnami/nginx:1.21.3-debian-10-r11" already present on machine
 Normal   Created    41s                kubelet            Created container generate-tls-certs
 Normal   Started    41s                kubelet            Started container generate-tls-certs
 Normal   Pulled     40s                kubelet            Container image "docker.io/bitnami/mongodb-exporter:0.11.2-debian-10-r284" already present on machine
 Normal   Created    39s                kubelet            Created container metrics
 Normal   Started    39s                kubelet            Started container metrics
 Normal   Pulled     20s (x3 over 40s)  kubelet            Container image "docker.io/bitnami/mongodb:4.4.9-debian-10-r0" already present on machine
 Normal   Created    19s (x3 over 40s)  kubelet            Created container mongodb
 Normal   Started    19s (x3 over 40s)  kubelet            Started container mongodb
 Warning  BackOff    14s (x6 over 37s)  kubelet            Back-off restarting failed container

2°- kubectl describe pod -n demo fa-mogodb-arbiter-0

Name:         fa-mongodb-arbiter-0
Namespace:    demo
Priority:     0
Node:         selenium03.france-atelier.fr/54.38.46.127
Start Time:   Thu, 21 Oct 2021 10:02:12 +0200
Labels:       app.kubernetes.io/component=arbiter
              app.kubernetes.io/instance=fa-mongodb
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=mongodb
              controller-revision-hash=fa-mongodb-arbiter-5d7564787f
              helm.sh/chart=mongodb-10.26.3
              statefulset.kubernetes.io/pod-name=fa-mongodb-arbiter-0
Annotations:  cni.projectcalico.org/podIP: 10.244.20.226/32
              cni.projectcalico.org/podIPs: 10.244.20.226/32
Status:       Running
IP:           10.244.20.226
IPs:
  IP:           10.244.20.226
Controlled By:  StatefulSet/fa-mongodb-arbiter
Init Containers:
  generate-client:
    Container ID:  docker://ce3cf1104997ba08090390d12a8fb21139f39acab077003396608d39d6925b11
    Image:         docker.io/bitnami/nginx:1.21.3-debian-10-r11
    Image ID:      docker-pullable://bitnami/nginx@sha256:603821233cc6c4fa477d4dcce91db6b9a2629804fa05de1e8ecd9312d4e4c796
    Port:          <none>
    Host Port:     <none>
    Command:
      sh
      -c
      /bin/bash <<'EOF'
      my_hostname=$(hostname)
      svc=$(echo -n "$my_hostname" | sed s/-[0-9]*$//)-headless

      cp /certs/CAs/* /certs/

      cat >/certs/openssl.cnf <<EOL
      [req]
      req_extensions = v3_req
      distinguished_name = req_distinguished_name
      [req_distinguished_name]
      [ v3_req ]
      basicConstraints = CA:FALSE
      keyUsage = nonRepudiation, digitalSignature, keyEncipherment
      subjectAltName = @alt_names
      [alt_names]
      DNS.1 = $svc
      DNS.2 = $my_hostname
      DNS.3 = $my_hostname.$svc.$MY_POD_NAMESPACE.svc.cluster.local
      DNS.4 = localhost
      DNS.5 = 127.0.0.1
      EOL

      export RANDFILE=/certs/.rnd && openssl genrsa -out /certs/mongo.key 2048
      #Create the client/server cert
      openssl req -new -key /certs/mongo.key -out /certs/mongo.csr -subj "/C=US/O=My Organisations/OU=IT/CN=$my_hostname" -config /certs/openssl.cnf
      #Signing the server cert with the CA cert and key
      openssl x509 -req -in /certs/mongo.csr -CA /certs/mongodb-ca-cert -CAkey /certs/mongodb-ca-key -CAcreateserial -out /certs/mongo.crt -days 3650 -extensions v3_req -extfile /certs/openssl.cnf
      rm /certs/mongo.csr
      #Concatenate to a pem file for use as the client PEM file which can be used for both member and client authentication.
      cat /certs/mongo.crt /certs/mongo.key > /certs/mongodb.pem
      cd /certs/
      shopt -s extglob
      rm -rf !(mongodb-ca-cert|mongodb.pem|CAs|openssl.cnf)
      chmod 0600 mongodb-ca-cert mongodb.pem
      EOF

    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 21 Oct 2021 10:02:14 +0200
      Finished:     Thu, 21 Oct 2021 10:02:17 +0200
    Ready:          True
    Restart Count:  0
    Environment:
      MY_POD_NAMESPACE:  demo (v1:metadata.namespace)
    Mounts:
      /certs from certs (rw)
      /certs/CAs from certs-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lqwsd (ro)
Containers:
  mongodb-arbiter:
    Container ID:   docker://c7f1744bcf1b3c7d1039da14d9b9a1937be435d29d9ca579d579aeeacd32405e
    Image:          docker.io/bitnami/mongodb:4.4.9-debian-10-r0
    Image ID:       docker-pullable://bitnami/mongodb@sha256:a812b4ad0c94585221449ae5c904dd9dea35fedfa5b31f2a5992c0a3c4c59f58
    Port:           27017/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Thu, 21 Oct 2021 10:05:43 +0200
      Finished:     Thu, 21 Oct 2021 10:05:47 +0200
    Ready:          False
    Restart Count:  5
    Limits:
      cpu:     100m
      memory:  128Mi
    Requests:
      cpu:      100m
      memory:   128Mi
    Liveness:   tcp-socket :mongodb delay=30s timeout=5s period=10s #success=1 #failure=6
    Readiness:  tcp-socket :mongodb delay=5s timeout=5s period=10s #success=1 #failure=6
    Environment:
      BITNAMI_DEBUG:                          true
      MY_POD_NAME:                            fa-mongodb-arbiter-0 (v1:metadata.name)
      MY_POD_NAMESPACE:                       demo (v1:metadata.namespace)
      K8S_SERVICE_NAME:                       fa-mongodb-arbiter-headless
      MONGODB_REPLICA_SET_MODE:               arbiter
      MONGODB_INITIAL_PRIMARY_HOST:           fa-mongodb-0.fa-mongodb-headless.$(MY_POD_NAMESPACE).svc.cluster.local
      MONGODB_REPLICA_SET_NAME:               rs0
      MONGODB_ADVERTISED_HOSTNAME:            $(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
      MONGODB_INITIAL_PRIMARY_ROOT_USER:      root
      MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD:  <set to the key 'mongodb-root-password' in secret 'mongodb-secret'>    Optional: false
      MONGODB_REPLICA_SET_KEY:                <set to the key 'mongodb-replica-set-key' in secret 'mongodb-secret'>  Optional: false
      ALLOW_EMPTY_PASSWORD:                   no
      MONGODB_EXTRA_FLAGS:                    --tlsMode=requireTLS --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert
      MONGODB_CLIENT_EXTRA_FLAGS:             --tls --tlsCertificateKeyFile=/certs/mongodb.pem --tlsCAFile=/certs/mongodb-ca-cert
      TZ:                                     Europe/Paris
    Mounts:
      /certs from certs (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lqwsd (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  certs:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  certs-volume:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  fa-mongodb-ca
    Optional:    false
  kube-api-access-lqwsd:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  4m38s                  default-scheduler  Successfully assigned demo/fa-mongodb-arbiter-0 to selenium03.france-atelier.fr
  Normal   Pulled     4m36s                  kubelet            Container image "docker.io/bitnami/nginx:1.21.3-debian-10-r11" already present on machine
  Normal   Created    4m36s                  kubelet            Created container generate-client
  Normal   Started    4m36s                  kubelet            Started container generate-client
  Normal   Created    3m30s (x4 over 4m32s)  kubelet            Created container mongodb-arbiter
  Normal   Started    3m30s (x4 over 4m32s)  kubelet            Started container mongodb-arbiter
  Warning  BackOff    2m51s (x9 over 4m25s)  kubelet            Back-off restarting failed container
  Normal   Pulled     2m38s (x5 over 4m32s)  kubelet            Container image "docker.io/bitnami/mongodb:4.4.9-debian-10-r0" already present on machine

3°- helm get values fa-mongodb -n demo

USER-SUPPLIED VALUES:
affinity: {}
annotations: {}
arbiter:
  affinity: {}
  annotations: {}
  args: []
  command: []
  configuration: ""
  containerSecurityContext:
    enabled: true
    runAsUser: 1002
  customLivenessProbe: {}
  customReadinessProbe: {}
  enabled: true
  existingConfigmap: ""
  extraEnvVars:
  - name: TZ
    value: Europe/Paris
  extraEnvVarsCM: ""
  extraEnvVarsSecret: ""
  extraFlags: []
  extraVolumeMounts: []
  extraVolumes: []
  hostAliases: []
  initContainers: []
  labels: {}
  livenessProbe:
    enabled: true
    failureThreshold: 6
    initialDelaySeconds: 30
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  nodeAffinityPreset:
    key: ""
    type: ""
    values: []
  nodeSelector: {}
  pdb:
    create: false
    maxUnavailable: ""
    minAvailable: 1
  podAffinityPreset: ""
  podAnnotations: {}
  podAntiAffinityPreset: soft
  podLabels: {}
  podSecurityContext:
    enabled: true
    fsGroup: 1002
    sysctls: []
  priorityClassName: ""
  readinessProbe:
    enabled: true
    failureThreshold: 6
    initialDelaySeconds: 5
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  resources:
    limits:
      cpu: 100m
      memory: 128Mi
    requests:
      cpu: 100m
      memory: 128Mi
  runtimeClassName: ""
  service:
    nameOverride: ""
  sidecars: []
  tolerations: []
architecture: replicaset
args: []
auth:
  database: ""
  enabled: true
  existingSecret: mongodb-secret
  password: ""
  replicaSetKey: ""
  rootPassword: ""
  rootUser: root
  username: ""
clusterDomain: cluster.local
command: []
commonAnnotations: {}
commonLabels: {}
configuration: "storage:\n   dbPath: /opt/mongo/demo/data/db\n   journal:\n     enabled:
  true\n   directoryPerDB: false\nsystemLog:\n   destination: file\n   quiet: false\n
  \  logAppend: true\n   logRotate: reopen\n   path: /var/mongo/demo/mongodb.log\n
  \  verbosity: 0\nnet:\n   port: 27017\n   unixDomainSocket:\n     enabled: true\n
  \    pathPrefix: /tmp\n     filePermissions: 0700\n   ipv6: false\n   bindIpAll:
  true\nprocessManagement:\n   timeZoneInfo: Europe/Paris "
containerSecurityContext:
  enabled: true
  runAsNonRoot: true
  runAsUser: 1002
customLivenessProbe: {}
customReadinessProbe: {}
customStartupProbe: {}
diagnosticMode:
  args:
  - infinity
  command:
  - sleep
  enabled: false
directoryPerDB: false
disableJavascript: false
disableSystemLog: false
enableIPv6: false
enableJournal: true
existingConfigmap: ""
externalAccess:
  autoDiscovery:
    enabled: false
    image:
      pullPolicy: IfNotPresent
      pullSecrets: []
      registry: docker.io
      repository: bitnami/kubectl
      tag: 1.19.15-debian-10-r2
    resources:
      limits: {}
      requests: {}
  enabled: false
  hidden:
    enabled: false
    service:
      annotations: {}
      domain: ""
      loadBalancerIPs: []
      loadBalancerSourceRanges: []
      nodePorts: []
      port: 27017
      type: LoadBalancer
  service:
    annotations: {}
    domain: ""
    loadBalancerIPs: []
    loadBalancerSourceRanges: []
    nodePorts:
    - 30001
    - 30002
    - 30003
    port: 27017
    type: NodePort
extraEnvVars:
- name: TZ
  value: Europe/Paris
extraEnvVarsCM: ""
extraEnvVarsSecret: ""
extraFlags: []
extraVolumeMounts: []
extraVolumes: []
fullnameOverride: ""
global:
  imagePullSecrets: []
  imageRegistry: ""
  namespaceOverride: demo
  storageClass: ""
hidden:
  affinity: {}
  annotations: {}
  args: []
  command: []
  configuration: ""
  customLivenessProbe: {}
  customReadinessProbe: {}
  enabled: false
  existingConfigmap: ""
  extraEnvVars: []
  extraEnvVarsCM: ""
  extraEnvVarsSecret: ""
  extraFlags: []
  extraVolumeMounts: []
  extraVolumes: []
  initContainers: []
  labels: {}
  livenessProbe:
    enabled: true
    failureThreshold: 6
    initialDelaySeconds: 30
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  nodeAffinityPreset:
    key: ""
    type: ""
    values: []
  nodeSelector: {}
  pdb:
    create: false
    maxUnavailable: ""
    minAvailable: 1
  persistence:
    accessModes:
    - ReadWriteOnce
    annotations: {}
    enabled: true
    mountPath: /bitnami/mongodb
    size: 8Gi
    storageClass: ""
    subPath: ""
    volumeClaimTemplates:
      dataSource: {}
      selector: {}
  podAffinityPreset: ""
  podAnnotations: {}
  podAntiAffinityPreset: soft
  podLabels: {}
  podManagementPolicy: OrderedReady
  priorityClassName: ""
  readinessProbe:
    enabled: true
    failureThreshold: 6
    initialDelaySeconds: 5
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  replicaCount: 1
  resources:
    limits: {}
    requests: {}
  runtimeClassName: ""
  sidecars: []
  strategyType: RollingUpdate
  tolerations: []
hostAliases: []
image:
  debug: true
  pullPolicy: IfNotPresent
  pullSecrets: []
  registry: docker.io
  repository: bitnami/mongodb
  tag: 4.4.9-debian-10-r0
initContainers: []
initdbScripts: {}
initdbScriptsConfigMap: ""
labels: {}
livenessProbe:
  enabled: true
  failureThreshold: 6
  initialDelaySeconds: 30
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 5
metrics:
  containerPort: 9216
  enabled: true
  extraFlags: ""
  extraUri: ""
  image:
    pullPolicy: IfNotPresent
    pullSecrets: []
    registry: docker.io
    repository: bitnami/mongodb-exporter
    tag: 0.11.2-debian-10-r284
  livenessProbe:
    enabled: true
    failureThreshold: 3
    initialDelaySeconds: 15
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 5
  password: ""
  prometheusRule:
    additionalLabels: {}
    enabled: true
    namespace: demo
    rules:
    - name: HighRequestLatency
      rules:
      - alert: HighRequestLatency
        annotations:
          summary: High request latency
        expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
        for: 10m
        labels:
          severity: page
  readinessProbe:
    enabled: true
    failureThreshold: 3
    initialDelaySeconds: 5
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 1
  resources:
    limits:
      cpu: 100m
      memory: 128Mi
    requests:
      cpu: 100m
      memory: 128Mi
  service:
    annotations:
      prometheus.io/path: /metrics
      prometheus.io/port: '{{ .Values.metrics.service.port }}'
      prometheus.io/scrape: "true"
    port: 9216
    type: ClusterIP
  serviceMonitor:
    additionalLabels: {}
    enabled: true
    interval: 30s
    metricRelabelings: []
    namespace: demo
    relabellings: []
    scrapeTimeout: 30s
  username: ""
nameOverride: ""
nodeAffinityPreset:
  key: ""
  type: ""
  values: []
nodeSelector: {}
pdb:
  create: false
  maxUnavailable: ""
  minAvailable: 1
persistence:
  accessModes:
  - ReadWriteOnce
  annotations: {}
  enabled: true
  existingClaim: ""
  mountPath: /opt/mongodb/demo/data/db
  size: 200Gi
  storageClass: local-path
  subPath: ""
  volumeClaimTemplates:
    dataSource: {}
    requests: {}
    selector: {}
podAffinityPreset: ""
podAnnotations: {}
podAntiAffinityPreset: soft
podLabels: {}
podManagementPolicy: OrderedReady
podSecurityContext:
  enabled: true
  fsGroup: 1002
  sysctls: []
podSecurityPolicy:
  allowPrivilegeEscalation: false
  create: false
  privileged: false
  spec: {}
priorityClassName: ""
rbac:
  create: false
  role:
    rules: []
readinessProbe:
  enabled: true
  failureThreshold: 6
  initialDelaySeconds: 5
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 5
replicaCount: 3
replicaSetHostnames: true
replicaSetName: rs0
resources:
  limits:
    cpu: 1.5
    memory: 2Gi
  requests:
    cpu: 500m
    memory: 256Mi
runtimeClassName: ""
schedulerName: ""
service:
  annotations: {}
  clusterIP: ""
  externalIPs: []
  loadBalancerIP: ""
  loadBalancerSourceRanges: []
  nameOverride: ""
  nodePort: ""
  port: 27017
  portName: mongodb
  type: ClusterIP
serviceAccount:
  annotations: {}
  create: true
  name: mongodb-sa
sidecars: []
startupProbe:
  enabled: false
  failureThreshold: 30
  initialDelaySeconds: 5
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 5
strategyType: RollingUpdate
systemLogVerbosity: 0
tls:
  autoGenerated: true
  caCert: ""
  caKey: ""
  enabled: true
  existingSecret: ""
  image:
    pullPolicy: IfNotPresent
    registry: docker.io
    repository: bitnami/nginx
    tag: 1.21.3-debian-10-r11
tolerations: []
useStatefulSet: false
volumePermissions:
  enabled: true
  image:
    pullPolicy: Always
    pullSecrets: []
    registry: docker.io
    repository: bitnami/bitnami-shell
    tag: 10-debian-10-r197
  resources:
    limits:
      cpu: 500m
      memory: 512Mi
    requests:
      cpu: 100m
      memory: 128Mi
  securityContext:
    runAsUser: 0

fdarif avatar Oct 21 '21 08:10 fdarif

Hi @fayssaldarif , I am afraid it does not seem to be useful information on the describes. About the provided values, I wanted to see only the values you overwrite, not sure why helm get values returned you all those values. Could share them again with just the ones you changed please?

miguelaeh avatar Oct 21 '21 08:10 miguelaeh

Hi @miguelaeh Sorry if it wasn't clear enough, here you can find only what I have changed in values yaml file.

global:
  namespaceOverride: "demo"
architecture: replicaset

auth:
  existingSecret: "mongodb-secret"

tls:
  enabled: true
  autoGenerated: true

configuration: |-
  storage:
     dbPath: /opt/mongo/demo/data/db
     journal:
       enabled: true
     directoryPerDB: false
  systemLog:
     destination: file
     quiet: false
     logAppend: true
     logRotate: reopen
     path: /var/mongo/demo/mongodb.log
     verbosity: 0
  net:
     port: 27017
     unixDomainSocket:
       enabled: true
       pathPrefix: /tmp
       filePermissions: 0700
     ipv6: false
     bindIpAll: true
  processManagement:
     timeZoneInfo: Europe/Paris

extraEnvVars:
- name: TZ
  value: Europe/Paris

podSecurityContext:
  enabled: true
  fsGroup: 1002

containerSecurityContext:
  enabled: true
  runAsUser: 1002
  runAsNonRoot: true

resources:
  limits:
    cpu: 1.5
    memory: 2Gi
  requests: 
    cpu: 500m
    memory: 256Mi

externalAccess:
  service:
    type: NodePort
    nodePorts:
        - 30001
        - 30002
        - 30003

persistence:
  enabled: true
  storageClass: "local-path"
  size: 200Gi
  mountPath: /opt/mongodb/demo/data/db

serviceAccount:
  create: true
  name: "mongodb-sa"

volumePermissions:
  enabled: true 
  resources:
    limits:
      cpu: 500m
      memory: 512Mi
    requests:
       cpu: 100m
       memory: 128Mi
arbiter:
  enabled: true
  extraEnvVars:
   - name: TZ
     value: Europe/Paris
  podSecurityContext:
    enabled: true
    fsGroup: 1002
  containerSecurityContext:
    enabled: true
    runAsUser: 1002
  resources:
    limits:
        cpu: 100m
        memory: 128Mi
    requests:
        cpu: 100m
        memory: 128Mi

I have enbaled also the metrics container which is working fine within the Pod.

metrics:
  enabled: true
  resources:
    limits:
       cpu: 100m
       memory: 128Mi
    requests:
       cpu: 100m
       memory: 128Mi
  serviceMonitor:
    enabled: true
    namespace: "demo"
   
  prometheusRule:
    enabled: true
    namespace: "demo"
    
    rules:
     - name: HighRequestLatency
       rules:
       - alert: HighRequestLatency
         expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
         for: 10m
         labels:
           severity: page
         annotations:
           summary: High request latency

fdarif avatar Oct 21 '21 09:10 fdarif

Hi @miguelaeh Do you have any updates for this issue please ?

fdarif avatar Oct 22 '21 07:10 fdarif

Hi @fayssaldarif , With your values.yaml I am able to reproduce it. I tested several things and I am only able to make it work by not enabling TLS. I am not sure why right now. This will probably require more investigation. It is probably a corner case in the combination parameters you provided, since providing only TLS it works too.

miguelaeh avatar Oct 22 '21 08:10 miguelaeh

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Nov 07 '21 01:11 github-actions[bot]

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

github-actions[bot] avatar Nov 13 '21 01:11 github-actions[bot]