大网数据广告活动
服务器运维问答

Kubernetes PV with Block storage over internet - Secure?

· 52CE 我爱测

I'm trying to create Persistent Volume on my k8s cluster with DigitalOcean Block storage, Using CSI driver . It works fine, but I also wants to know that this is secure even for production. I'm still looking for docs about PV sec…

问题原文

原帖链接 · Yechan Kim · CC BY-SA 4.0

I'm trying to create Persistent Volume on my k8s cluster with DigitalOcean Block storage, Using CSI driver.

It works fine, but I also wants to know that this is secure even for production.

I'm still looking for docs about PV security but can't find what i need.

I need your opinion. Thanks.

已采纳解答

原帖链接 · Nick_Kh · CC BY-SA 4.0

I think it might be helpful to consider following overall security aspects to apply them on your Kubernetes cluster as described in Kubernetes Documentation. I guess it can be a starting point for you to analyze potential security breaches in you Kubernetes Cluster. However, you can find some information about securing Persistent Volume storage below.

Persistent Volume (PV) storage consists with essential strategies which you can apply using SecurityContext section in a pod definition, like Group IDs, the user ID, and SELinux values. Group IDs are global to the pod and applied to all containers defined in the pod. User IDs can also be global, or specific to each container. Actually, there are four sections aiming to control access to volumes:

supplementalGroups - Supplemental groups are regular Linux groups. When a process runs in Linux, it has a UID, a GID, and one or more supplemental groups typically used for controlling access to shared storage, such as NFS and GlusterFS:

apiVersion: v1
    kind: Pod
    ...
    spec:
      containers:
      - name: ...
        volumeMounts:
        - name: nfs 
          mountPath: /usr/share/... 
      securityContext: 
        supplementalGroups: [5555] 
      volumes:
      - name: nfs 
        nfs:
          server: <nfs_server_ip_or_host>
          path: /opt/nfs

fsGroup - Defines a pod’s "file system group" ID, which is added to the container’s supplemental groups. The supplementalGroups ID is applied to shared storage, whereas the fsGroup ID is used for block storage.

 kind: Pod
...
spec:
  containers:
  - name: ...
  securityContext: 
    fsGroup: 5555

runAsUser - User IDs can be defined globally to all containers, or specific to individual containers (or both):

spec:
  containers:
  - name: ...
    securityContext:
      runAsUser: 1000100001

seLinuxOptions - Possibility to assign SELinux labels to a container with several values for access control security policies to identify level label:

  securityContext: 
    seLinuxOptions:
      level: "s0:c123,c456"

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。