iT邦幫忙

2025 iThome 鐵人賽

DAY 26
0
Cloud Native

我在 CKS 考完只拿 47% 後痛定思痛決定好好準備內容系列 第 26

6-4. Ensure immutability of containers at runtime

  • 分享至 

  • xImage
  •  

Mutable 與 Immutable 主要是內容能不能被覆寫或者是更新,以 pod 為例,如果修改 pod 內的 image 版本或者是 cmd 會需要將 pod 刪除並重新啟動。
除了 pod 外本章節主要會比較關注的是對檔案的讀寫。

可以參考以下配置

apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx
  name: nginx
spec:
  containers:
  - image: nginx
    name: nginx
    securityContext:
      readOnlyRootFilesystem: true  # 根檔案系統設為唯讀,無法寫入
      privileged: false             # 禁用特權模式,無法提權
    volumeMounts:
    - name: cache-volume            # 額外需要存取的檔案可以透過此方式掛載並讀取
      mountPath: /var/cache/nginx
    - name: runtime-volume
      mountPath: /var/run
  volumes:
  - name: cache-volume
    emptyDir: {}
  - name: runtime-volume
    emptyDir: {}

參考資料

[1] https://notes.kodekloud.com/docs/Certified-Kubernetes-Security-Specialist-CKS/Monitoring-Logging-and-Runtime-Security/Mutable-vs-Immutable-Infrastructure
[2] https://notes.kodekloud.com/docs/Certified-Kubernetes-Security-Specialist-CKS/Monitoring-Logging-and-Runtime-Security/Ensure-Immutability-of-Containers-at-Runtime


上一篇
[Day25] 6-3. Investigate and identify phases of attack and bad actors within the environment
下一篇
[Day27] 6-5. Use Kubernetes audit logs to monitor access
系列文
我在 CKS 考完只拿 47% 後痛定思痛決定好好準備內容27
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言