Kubernetes

Kubernetes shareProcessNamespace

DevelopC 2023. 3. 30. 20:11
728x90

Kubernetes shareProcessNamespace

Kubernetes shareProcessNamespace는 동일한 Pod 내의 여러 컨테이너가 하나의 프로세스 네임스페이스를 공유하게 해주는 기능입니다. 이를 통해 컨테이너 간에 프로세스를 공유하고 상호작용할 수 있게 되며, 디버깅 및 모니터링 작업을 더욱 용이하게 합니다. 프로세스 네임스페이스란 리눅스 시스템에서 프로세스를 격리하고 서로의 프로세스 목록을 볼 수 없게 하는 메커니즘입니다. Kubernetes shareProcessNamespace를 사용하려면, Pod 스펙(spec)에서 shareProcessNamespace 필드를 true로 설정해야 합니다. 이 기능을 사용할 때는 보안과 호환성 문제에 주의해야 하며, 프로세스 간 격리가 이루어지지 않기 때문에 신뢰할 수 없는 컨테이너가 함께 실행되지 않도록 주의해야 합니다. 또한, Kubernetes shareProcessNamespace는 Linux 환경에서만 작동하며, Windows에서는 지원되지 않습니다.

apiVersion: v1
kind: Pod
metadata:
  name: shared-process-namespace-pod
spec:
  shareProcessNamespace: true
  containers:
  - name: main-container
    image: main-image
  - name: sidecar-container
    image: sidecar-image

 

참고

 

Share Process Namespace between Containers in a Pod

This page shows how to configure process namespace sharing for a pod. When process namespace sharing is enabled, processes in a container are visible to all other containers in the same pod. You can use this feature to configure cooperating containers, suc

kubernetes.io

 

728x90