不允许Kubernetes mysql chown操作 [英] kubernetes mysql chown operation not permitted

查看:398
本文介绍了不允许Kubernetes mysql chown操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用Kubernetes,并在本地运行的ESX上安装了一个小型集群。我在Fedora中使用Project Atomic安装了两个从属节点和一个主节点。群集已全部安装好,并且似乎正在运行。但是,我首先要启动并运行一个MySQL容器,但是无论如何我都无法运行它。

I am currently experimenting with Kubernetes and have installed a small cluster on ESX infra I had running here locally. I installed two slave nodes with a master node using Project Atomic with Fedora. The cluster is all installed fine and seems to be running. However I first want to get a MySQL container up and running, but no matter what I try i cannot get it to run.

apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels: 
    name: mysql
spec: 
  containers: 
    - resources:
       limits :
          cpu: 0.5
      image: mysql:5.6
      name: mysql
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: myPassw0rd
      ports: 
        - containerPort: 3306
          name: mysql
      volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
  volumes:
    - name: mysql-persistent-storage
      nfs:
        server: 10.0.0.2
        path: "/export/mysql"

对于该卷,我已经尝试过各种解决方案,我尝试使用有或无主张的持久卷。我尝试使用主机卷和emptyDir,但是在容器启动时,我总是会遇到此错误:

For the volume I already tried all kinds of solutions, I tried using persistent volume with and without claim. I tried using host volume and emptyDir, but I always end up with this error when the container starts:

chown:更改'/ var / lib / mysql /'的所有权:不允许操作

chown: changing ownership of '/var/lib/mysql/': Operation not permitted

我必须做一些愚蠢的事情,但是不知道该怎么办?

I must be doing something stupid, but no idea what to do here?

推荐答案

好吧,看来我可以回答自己的问题了,问题出在NFS共享上,该共享被用作持久卷。我在导出中将其设置为 squash_all,但需要有一个 no_root_squash,以便在docker容器被nfs绑定卷锁定的情况下允许根。

Ok it seems I can answer my own question, the problem was lying in the NFS share that was being used as the persistent volume. I had it set to 'squash_all' in the export but it needs to have a 'no_root_squash' to allow root in case of docker container to chown on the nfs bound volume.

这篇关于不允许Kubernetes mysql chown操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆