K8S file mount with secret - Error Read-only file system

5/6/2020

Deploying blockchain network (Corda) with K8S. We have added few secretes which will be mounted on container.

Error

Internal.NodeStartupLogging.invoke - Exception during node startup: /opt/corda/additional-node-infos/nodeInfo-777DA369F066FE34BEDE3E6334A1006A4026A02DD76AFA798204BD015C9965DE: Read-only file system

YML file

apiVersion: v1
kind: List
items:
- kind: Service
  apiVersion: v1
  metadata:
    name: notary
  spec:
    selector:
      app: notary
    ports:
    - protocol: TCP
      port: 10000
      targetPort: 10000
      name: p2p
    - protocol: TCP
      port: 10001
      targetPort: 10001
      name: rpc
- kind: Deployment
  apiVersion: apps/v1
  metadata:
    name: notary
    labels:
      app: notary
  spec:
    selector: 
        matchLabels:
            app: notary
    replicas: 1
    strategy:
      type: Recreate
      rollingUpdate: null
    template:
      metadata:
        labels:
          app: notary
      spec:
        hostname: localhost
        containers:
        - name: cordapp
          image: blockchaingoa/corda-node:4.0
          resources:
            limits:
              memory: "3Gi"
            requests:
              memory: "2Gi"
          ports:
            - containerPort: 10000
              name: p2p
            - containerPort: 10001
              name: rpc
          volumeMounts:
          - name: node-config
            mountPath: "/opt/corda/node.conf"
            subPath: "node.conf"
            readOnly: true
          - name: node-config
            mountPath: "/opt/corda/network-parameters"
            subPath: "network-parameters"
            readOnly: true
          - name: node-config
            mountPath: "/opt/corda/log4j.xml"
            subPath: "log4j.xml"
            readOnly: true
          - name: node-certificates
            mountPath: "/opt/corda/certificates"
            readOnly: true
          - name: additional-node-infos
            mountPath: "/opt/corda/additional-node-infos"
            readOnly: true
          livenessProbe:
            tcpSocket:
              port: 10001
            initialDelaySeconds: 15
            periodSeconds: 20
        volumes:
        - name: node-config
          secret:
            secretName: notary-config
        - name: node-certificates
          secret:
            secretName: notary-keystore
        - name: additional-node-infos
          secret:
            secretName: additional-node-infos
-- Dinesh Rivankar
kubectl
kubernetes

0 Answers