<p>I have created the Kubernetes cluster.</p>
<p>Configuration : <strong>4 CPU X 16 GB Memory</strong></p>
<p>On the above  Kubernetes cluster, I deployed a hyperledger blockchain network with Hyperledger Explorer (as pod). The Blockchain network is working fine.  Hyperledger Explorer is also working but only for a few hours after that it gets stop, neither showing error nor warning, and the pod is also in &quot;running&quot; status. But is not synching blockchain transaction data.</p>
<p>I created two pods, one for explorer and one for explorer-DB. I checked logs of the explorer-db pod and get below lines</p>
<blockquote>
<p>2021-12-24 17:12:58.232 UTC [31] LOG:  aborting any active
transactions 2021-12-24 17:12:58.269 UTC [31] LOG:  worker process:
logical replication launcher (PID 38) exited with exit code 1
2021-12-24 17:12:58.289 UTC [33] LOG:  shutting down 2021-12-24
17:12:58.490 UTC [31] LOG:  database system is shut down  done server
stopped PostgreSQL init process complete; ready for start up.
2021-12-24 17:12:58.691 UTC [1] LOG:  listening on IPv4 address
&quot;0.0.0.0&quot;, port 5432 2021-12-24 17:12:58.691 UTC [1] LOG:  listening
on IPv6 address &quot;::&quot;, port 5432 2021-12-24 17:12:58.709 UTC [1] LOG:
listening on Unix socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot;
2021-12-24 17:12:58.989 UTC [65] LOG:  database system was shut down
at 2021-12-24 17:12:58 UTC 2021-12-24 17:12:59.089 UTC [1] LOG:
database system is ready to accept connections</p>
</blockquote>

Piyusha Patel
<p>I figured out the solution for the above problem with the <code>Kubernetes sidecar pattern</code>. So whenever my main container restart due to some memory issue its sidecar container also restarts automatically.</p>
<pre><code>  containers:
    - name: peer
      image: hyperledger/fabric-peer:2.3
      imagePullPolicy: &quot;Always&quot;
      command: [&quot;sh&quot;, &quot;-c&quot;, &quot;peer node start&quot;]
      env:
        - name: CORE_PEER_ADDRESSAUTODETECT
          value: &quot;true&quot;
        - name: CORE_PEER_ID
          value: peer0-org1
        - name: CORE_PEER_ADDRESS
          value: peer0-org1:7051
        - name: CORE_PEER_LISTENADDRESS
          value: 0.0.0.0:7051
        - name: CORE_PEER_EVENTS_ADDRESS
          value: 0.0.0.0:7061
        - name: CORE_PEER_GOSSIP_BOOTSTRAP
          value: peer0-org1:7051
        - name: CORE_PEER_GOSSIP_USELEADERELECTION
          value: &quot;true&quot;
        - name: CORE_PEER_PROFILE_ENABLED
          value: &quot;true&quot;
        - name: CORE_PEER_LOCALMSPID
          value: Org1MSP
        - name: CORE_PEER_MSPCONFIGPATH
          value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp
        - name: FABRIC_LOGGING_SPEC
          value: debug
        - name: CORE_PEER_TLS_ENABLED
          value: &quot;true&quot;
        - name: CORE_PEER_TLS_CERT_FILE
          value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
        - name: CORE_PEER_TLS_KEY_FILE
          value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
        - name: CORE_PEER_TLS_ROOTCERT_FILE
          value: /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
        - name: CORE_LEDGER_STATE_STATEDATABASE
          value: &quot;CouchDB&quot;
        - name: CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
          value: &quot;localhost:5984&quot;
        - name: FABRIC_CFG_PATH
          value: /etc/hyperledger/fabric
        - name: CORE_OPERATIONS_LISTENADDRESS
          value: 0.0.0.0:9443
        - name: CORE_METRICS_PROVIDER
          value: prometheus
      ports:    
        - containerPort: 7051
        - containerPort: 7052
        - containerPort: 7053
        - containerPort: 9443
      resources:
        limits:
          memory: &quot;450Mi&quot;
          cpu: &quot;300m&quot;
        requests:
          memory: &quot;150Mi&quot;
          cpu: &quot;100m&quot;
      volumeMounts:
        - mountPath: /opt/gopath/src/github.com/chaincode/
          name: fabricfiles
          subPath: chaincode/
        - mountPath: /organizations
          name: fabricfiles
          subPath: organizations
        - mountPath: /var/hyperledger/production
          name: fabricfiles
          subPath: state/org1/peer0
        - mountPath: /etc/hyperledger/fabric/core.yaml
          name: builders-config
          subPath: core.yaml
        - mountPath: /builders/external/bin/detect
          name: external-builder-detect
          subPath: detect
        - mountPath: /builders/external/bin/build
          name: external-builder-build
          subPath: build
        - mountPath: /builders/external/bin/release
          name: external-builder-release
          subPath: release

    - name: couchdb
      image: hyperledger/fabric-couchdb:0.4.15
      resources:
        limits:
          memory: &quot;450Mi&quot;
          cpu: &quot;400m&quot;
      volumeMounts:
        - mountPath: /var/lib/couchdb
          name: fabricfiles
          subPath: state/org1/peer0-couchdb

    - name: explorer
      image: hyperledger/explorer:1.1.8

      # startupProbe:
      #     failureThreshold: 30
      #     periodSeconds: 30
      env:
        - name: DATABASE_HOST
          value: &quot;explorerdb-service&quot;
        - name: DATABASE_DATABASE
          value: &quot;fabricexplorer&quot;
        - name: DATABASE_USERNAME
          value: &quot;hppoc&quot;
        - name: DATABASE_PASSWD
          value: &quot;password&quot;
        - name: LOG_LEVEL_APP
          value: &quot;warn&quot;
        - name: LOG_LEVEL_DB
          value: &quot;debug&quot;
        - name: LOG_LEVEL_CONSOLE
          value: &quot;warn&quot;
        - name: LOG_CONSOLE_STDOUT
          value: &quot;true&quot;
        - name: DISCOVERY_AS_LOCALHOST
          value: &quot;false&quot;
        - name: NODE_TLS_REJECT_UNAUTHORIZED  
          value: &quot;0&quot;
      resources:
        limits:
          memory: &quot;300Mi&quot;
          cpu: &quot;300m&quot;
      ports:
        - containerPort: 8080
     # command:  [&quot;sh&quot;,&quot;-c&quot;,&quot;/opt/explorer/syncstart.sh&quot;]
      volumeMounts:
        - mountPath: /organizations
          name: fabricfiles
          subPath: organizations
        - mountPath: /opt/explorer/app/platform/fabric/config.json
          name: explorer-config
          subPath: config.json  
        - mountPath: /opt/explorer/app/platform/fabric/first-network.json
          name: explorer-config
          subPath: network.json  
    
</code></pre>
