<p>I am make a nfs file share and using it in kubernetes pods, but when I start pods, it give me tips :</p>

<pre><code>2020-05-31 03:00:06+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
chown: changing ownership of '/var/lib/mysql/': Operation not permitted
</code></pre>

<p>I searching from internet and understand the nfs default map other root login to nfsnobody account, if the privillege not correct, this error should happen, but I follow the steps and still not solve it. This is the ways I having tried:</p>

<p>1 addd unsecure config <code>no_root_squash</code> in <code>/etc/exports</code>:</p>

<pre><code>/mnt/data/apollodb/apollopv *(rw,sync,no_subtree_check,no_root_squash)
</code></pre>

<p>2 remove the PVC and PV and directly using nfs in pod like this:</p>

<pre><code>volumes:
        - name: apollo-mysql-persistent-storage
          nfs:
            server: 192.168.64.237
            path: /mnt/data/apollodb/apollopv
      containers:
        - name: mysql
          image: 'mysql:5.7'
          ports:
            - name: mysql
              containerPort: 3306
              protocol: TCP
          env:
            - name: MYSQL_ROOT_PASSWORD
              value: gfwge4LucnXwfefewegLwAd29QqJn4
          resources: {}
          volumeMounts:
            - name: apollo-mysql-persistent-storage
              mountPath: /var/lib/mysql
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      schedulerName: default-scheduler
</code></pre>

<p>this tell me the problem not in pod define but in the nfs config itself.</p>

<p>3 give every privillege using this command</p>

<pre><code>chmod 777 /mnt/data/apollodb/apollopv
</code></pre>

<p>4 chown to nfsnobody like this</p>

<pre><code>sudo chown nfsnobody:nfsnobody -R apollodb/
sudo chown 999:999 -R apollodb
</code></pre>

<p>but the problem still not solved,so what should I try to make it works?</p>

Dolphin
<p>You wouldn't set this via chown, you would use <code>fsGroup</code> security setting instead.</p>
