docker - 无法让容器在 k8s 中获取 apparmor 配置文件
问题描述
mount: tmpfs is write-protected, mounting read-only
mount: cannot mount tmpfs read-only
failed.
基于文档 re: annotations 和containers creator,这是我的部署文件的相关部分:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: unifi-video
annotations:
container.apparmor.security.beta.kubernetes.io/unifi-video: "unconfined"
spec:
replicas: 1
template:
metadata:
labels:
app: unifi-video
spec:
hostname: unifi-video
nodeSelector:
kubernetes.io/hostname: mira-b.home
volumes:
- name: dockerdata
persistentVolumeClaim:
claimName: dockerdata-nas
- name: cameradata
persistentVolumeClaim:
claimName: cameras-nas
containers:
- name: unifi-video
image: pducharme/unifi-video-controller:3.9.7
securityContext:
capabilities:
add:
- SYS_ADMIN
- DAC_READ_SEARCH
IT 特别呼吁
如果您收到此 tmpfs 挂载错误,请将 --security-opt apparmor:unconfined \ 添加到您的运行选项列表中。此错误已在 Ubuntu 上出现,但也可能出现在其他平台上。
但从我能找到的(现在搜索一个多小时)来看,实现这一点的方法是 k8s 是通过注释行。
我错过了什么吗?
解决方案
最终从 k8s 问题部分得到了答案。注释在错误的位置。这是执行此操作的正确方法:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: unifi-video
spec:
replicas: 1
template:
metadata:
annotations:
container.apparmor.security.beta.kubernetes.io/unifi-video: unconfined
labels:
app: unifi-video
这导致成功部署了带有 apparmor 的容器,允许安装 tempfs。
推荐阅读
- android - Firebase中云存储的带宽是多少?
- python - 如何在 Matplotlib 上一个接一个地绘制?
- reactjs - this.props.history 在 React JS 的控制台中显示 undefine
- javascript - [NODEMON]- babel-node 未被识别为内部或外部命令
- python - Mastermind Game,Pygame,添加猜测指标
- c# - 我想使用 blazor 在我的表单上应用验证
- ios - Swift 中的音频 CMSampleBuffer 音量变化
- javascript - 如何在点击事件上添加图像 - 联系表 7?
- r - R:调用 Matlab 函数并传递参数
- php - PHP - urlencode空格到“-”字符