如何在kubernetes中卸载分区

时间:2019-04-17 09:21:14

标签: kubernetes

我有一个吊舱和一个分割部分

kubectl exec pod-t -- lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0 298.1G  0 disk 
`-sda10   8:10        28G  0 part /etc/hosts
sr0      11:0    1  1024M  0 rom  
rbd5    252:80   0    15G  0 disk /usr/share/nginx/html

当我要卸载它时,我会看到

  

必须是超级用户才能卸载

#kubectl exec pod-t -- umount /dev/rbd5
umount: /usr/share/nginx/html: must be superuser to unmount
command terminated with exit code 32

广告连播是通过以下模板创建的:

apiVersion: v1
kind: Pod
metadata:
  name: pod-t
  namespace: default
  labels:
spec:
  containers:
  - name: nginxqw
    image: nginx:latest
    ports:
    - containerPort: 80
    volumeMounts:
    - name: content-data
      mountPath: /usr/share/nginx/html
  volumes:
  - name: content-data
    persistentVolumeClaim:
     claimName: pvc-t

我认为广告连播没有root权限。 我该怎么解决?

1 个答案:

答案 0 :(得分:0)

容器规范的SecurityContext上有一个特权标志。

我使用此模板

apiVersion: v1
kind: Pod
metadata:
  name: hello-world
spec:
  containers:
    - name: hello-world-container
      # The container definition
      # ...
      securityContext:
        privileged: true