<p>I'm running a mongoDB (5.0.12) instance as a kubernetes pod. Suddenly the pod is failing and I need some help to understand the logs:</p>
<pre><code>{&quot;t&quot;:{&quot;$date&quot;:&quot;2022-09-13T18:39:51.104+00:00&quot;},&quot;s&quot;:&quot;E&quot;,  &quot;c&quot;:&quot;STORAGE&quot;,  &quot;id&quot;:22435,   &quot;ctx&quot;:&quot;AuthorizationManager-1&quot;,&quot;msg&quot;:&quot;WiredTiger error&quot;,&quot;attr&quot;:{&quot;error&quot;:1,&quot;message&quot;:&quot;[1663094391:104664][1:0x7fc5224cc700], file:index-9--3195476868760592993.wt, WT_SESSION.open_cursor: __posix_open_file, 808: /data/db/index-9--3195476868760592993.wt: handle-open: open: Operation not permitted&quot;}}
{&quot;t&quot;:{&quot;$date&quot;:&quot;2022-09-13T18:39:51.104+00:00&quot;},&quot;s&quot;:&quot;F&quot;,  &quot;c&quot;:&quot;STORAGE&quot;,  &quot;id&quot;:50882,   &quot;ctx&quot;:&quot;AuthorizationManager-1&quot;,&quot;msg&quot;:&quot;Failed to open WiredTiger cursor. This may be due to data corruption&quot;,&quot;attr&quot;:{&quot;uri&quot;:&quot;table:index-9--3195476868760592993&quot;,&quot;config&quot;:&quot;overwrite=false&quot;,&quot;error&quot;:{&quot;code&quot;:8,&quot;codeName&quot;:&quot;UnknownError&quot;,&quot;errmsg&quot;:&quot;1: Operation not permitted&quot;},&quot;message&quot;:&quot;Please read the documentation for starting MongoDB with --repair here: http://dochub.mongodb.org/core/repair&quot;}}
{&quot;t&quot;:{&quot;$date&quot;:&quot;2022-09-13T18:39:51.104+00:00&quot;},&quot;s&quot;:&quot;F&quot;,  &quot;c&quot;:&quot;-&quot;,        &quot;id&quot;:23091,   &quot;ctx&quot;:&quot;AuthorizationManager-1&quot;,&quot;msg&quot;:&quot;Fatal assertion&quot;,&quot;attr&quot;:{&quot;msgid&quot;:50882,&quot;file&quot;:&quot;src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp&quot;,&quot;line&quot;:109}}
{&quot;t&quot;:{&quot;$date&quot;:&quot;2022-09-13T18:39:51.104+00:00&quot;},&quot;s&quot;:&quot;F&quot;,  &quot;c&quot;:&quot;-&quot;,        &quot;id&quot;:23092,   &quot;ctx&quot;:&quot;AuthorizationManager-1&quot;,&quot;msg&quot;:&quot;\n\n***aborting after fassert() failure\n\n&quot;}
</code></pre>
<p>So why is there <code>operation is not permitted</code>? I already run <code>mongod --repair</code>, but the error still occurs.</p>
<p>This is how the pod is deployed:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongodb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongodb
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      hostname: mongodb
      # securityContext:
      #   runAsUser: 999
      #   runAsGroup: 3000
      #   fsGroup: 2000
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: data
      containers:
        - name: mongodb
          image: mongo:5.0.12
          args: [&quot;--auth&quot;, &quot;--dbpath&quot;, &quot;/data/db&quot;]
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 27017
          volumeMounts:
            - mountPath: /data/db
              name: data
          # securityContext:
          #   allowPrivilegeEscalation: false
</code></pre>
<p><em>Update</em></p>
<p>The PVC:</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
</code></pre>

user3142695
<p>You can try checking the permissions for that file before execution:</p>
<pre><code>ls -l
</code></pre>
<p>then using <strong>chmod</strong> you can try changing the permission and then try executing it.</p>
<p>OR</p>
<p>You can refer here, this might help you:</p>
<blockquote>
<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/security-context/</a></p>
</blockquote>
