diff --git a/content/en/docs/tasks/configure-pod-container/share-process-namespace.md b/content/en/docs/tasks/configure-pod-container/share-process-namespace.md index 3564ba1ff0..3947b64a28 100644 --- a/content/en/docs/tasks/configure-pod-container/share-process-namespace.md +++ b/content/en/docs/tasks/configure-pod-container/share-process-namespace.md @@ -43,52 +43,58 @@ Process Namespace Sharing is enabled using the `ShareProcessNamespace` field of 1. Create the pod `nginx` on your cluster: - kubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml + ```shell + kubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml + ``` 1. Attach to the `shell` container and run `ps`: - ``` - kubectl attach -it nginx -c shell - ``` + ```shell + kubectl attach -it nginx -c shell + ``` - If you don't see a command prompt, try pressing enter. + If you don't see a command prompt, try pressing enter. - ``` - / # ps ax - PID USER TIME COMMAND - 1 root 0:00 /pause - 8 root 0:00 nginx: master process nginx -g daemon off; - 14 101 0:00 nginx: worker process - 15 root 0:00 sh - 21 root 0:00 ps ax - ``` + ``` + / # ps ax + PID USER TIME COMMAND + 1 root 0:00 /pause + 8 root 0:00 nginx: master process nginx -g daemon off; + 14 101 0:00 nginx: worker process + 15 root 0:00 sh + 21 root 0:00 ps ax + ``` You can signal processes in other containers. For example, send `SIGHUP` to nginx to restart the worker process. This requires the `SYS_PTRACE` capability. - / # kill -HUP 8 - / # ps ax - PID USER TIME COMMAND - 1 root 0:00 /pause - 8 root 0:00 nginx: master process nginx -g daemon off; - 15 root 0:00 sh - 22 101 0:00 nginx: worker process - 23 root 0:00 ps ax +``` +/ # kill -HUP 8 +/ # ps ax +PID USER TIME COMMAND + 1 root 0:00 /pause + 8 root 0:00 nginx: master process nginx -g daemon off; + 15 root 0:00 sh + 22 101 0:00 nginx: worker process + 23 root 0:00 ps ax +``` It's even possible to access another container image using the `/proc/$pid/root` link. - / # head /proc/8/root/etc/nginx/nginx.conf +``` +/ # head /proc/8/root/etc/nginx/nginx.conf - user nginx; - worker_processes 1; +user nginx; +worker_processes 1; - error_log /var/log/nginx/error.log warn; - pid /var/run/nginx.pid; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; - events { - worker_connections 1024; +events { + worker_connections 1024; +``` {{% /capture %}}