Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes selinux在containerd下不工作,selinux enable=true_Kubernetes_Selinux_Containerd - Fatal编程技术网

Kubernetes selinux在containerd下不工作,selinux enable=true

Kubernetes selinux在containerd下不工作,selinux enable=true,kubernetes,selinux,containerd,Kubernetes,Selinux,Containerd,我有两个k8s集群,一个使用docker,另一个直接使用containerd,都启用了selinux。 但是我发现selinux实际上并没有在containerd上工作,尽管这两个集群具有相同版本的containerd和runc 我错过了集装箱车的一些场景吗 docker:文件标签是容器文件,进程运行为容器,selinux工作正常 K8s version: 1.17 Docker version: 19.03.6 Containerd version: 1.2.10 selinux enable

我有两个k8s集群,一个使用docker,另一个直接使用containerd,都启用了selinux。 但是我发现selinux实际上并没有在containerd上工作,尽管这两个集群具有相同版本的containerd和runc

我错过了集装箱车的一些场景吗

docker:文件标签是容器文件,进程运行为容器,selinux工作正常

K8s version: 1.17
Docker version: 19.03.6
Containerd version: 1.2.10
selinux enable by adding ["selinux-enabled": true] to /etc/docker/daemon.json

// create pod using tomcat official image then check the process and file label
# kubectl exec tomcat -it -- ps -eZ
LABEL                             PID TTY          TIME CMD
system_u:system_r:container_t:s0:c655,c743          1 ?        00:00:00 java

# ls -Z /usr/local/openjdk-8/bin/java
system_u:object_r:container_file_t:s0:c655,c743 /usr/local/openjdk-8/bin/java
containerd:文件标签是container\u var\u lib\u t,进程运行为spc\u t,selinux毫无意义

K8s version: 1.15
Containerd version: 1.2.10
selinux enable by setting [enable_selinux = true] in /etc/containerd/config.toml

// create pod using tomcat official image then check the process and file label
# kubectl exec tomcat -it -- ps -eZ
LABEL                             PID TTY          TIME CMD
system_u:system_r:spc_t:s0          1 ?        00:00:00 java

# ls -Z /usr/local/openjdk-8/bin/java
system_u:object_r:container_var_lib_t:s0 /usr/local/openjdk-8/bin/java

// seems run as spc_t is correct
# sesearch -T -t container_var_lib_t | grep spc_t
   type_transition container_runtime_t container_var_lib_t : process spc_t;
从中我们可以看出:

Containerd包含对SELinux的最低支持。更准确地说,它 包含对在使用SELinux的系统上运行的支持,但不支持 使用SELinux提高容器安全性

所有容器都使用
system\u:system\r:container\u runtime\u t:s0
标签,但无其他标签 进行了分段

对于您使用Containerd所做的工作没有完全的支持。您的方法是正确的,但问题是缺少对此功能的支持