{"id":596,"date":"2020-04-05T22:39:15","date_gmt":"2020-04-05T14:39:15","guid":{"rendered":"https:\/\/www.myway5.com\/?p=596"},"modified":"2023-07-05T21:28:56","modified_gmt":"2023-07-05T13:28:56","slug":"kubernetes-mount-propagation","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/","title":{"rendered":"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236"},"content":{"rendered":"<h2>\u6982\u8ff0<\/h2>\n<p>\u4eca\u5929\u5728\u770b <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/aylei\/kubectl-debug\">kubectl-debug<\/a> \u8fd9\u4e2a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u770b\u5230\u5176\u90e8\u7f72\u6587\u4ef6\u7684 volumeMounuts \u4e2d\u4f7f\u7528\u4e86\u4e00\u4e2a mountPropagation \u5b57\u6bb5\uff0c\u56e0\u4e3a\u4e0d\u6e05\u695a\u8fd9\u4e2a\u5b57\u6bb5\u7684\u4f5c\u7528\uff0c\u5c31\u505a\u4e86\u4e00\u4e0b\u4e86\u89e3\u3002mount propagation \u80cc\u540e\u7684\u4e1c\u897f\u8fd8\u662f\u5f88\u591a\u7684\uff0c\u56e0\u6b64\u6574\u7406\u4e86\u8fd9\u7bc7\u6587\u7ae0\uff0c\u987a\u4fbf\u68b3\u7406\u4e00\u4e0b\u77e5\u8bc6\u70b9\u3002<\/p>\n<p>kubernetes \u7684 mount propagation \u7ffb\u8bd1\u6210\u4e2d\u6587\u5c31\u662f\u6302\u8f7d\u4f20\u64ad\u3002\u6302\u8f7d\u4f20\u64ad\u63d0\u4f9b\u4e86\u5171\u4eab\u5377\u6302\u8f7d\u7684\u80fd\u529b\uff0c\u5b83\u5141\u8bb8\u5728\u540c\u4e00\u4e2a Pod\uff0c\u751a\u81f3\u540c\u4e00\u4e2a\u8282\u70b9\u5185\uff0c\u5728\u591a\u4e2a\u5bb9\u5668\u4e4b\u95f4\u5171\u4eab\u5377\u7684\u6302\u8f7d\u3002<\/p>\n<h2>kubernetes \u7684\u6302\u8f7d\u4f20\u64ad<\/h2>\n<p>\u5377\u7684\u6302\u8f7d\u4f20\u64ad\u7531 Container.volumeMounts \u7684 mountPropagation \u5b57\u6bb5\u63a7\u5236\u3002\u5b83\u7684\u503c\u6709\uff1a<\/p>\n<ul>\n<li><code>None<\/code>: \u8fd9\u79cd\u5377\u6302\u8f7d\u5c06\u4e0d\u4f1a\u6536\u5230\u4efb\u4f55\u540e\u7eed\u7531 host \u521b\u5efa\u7684\u5728\u8fd9\u4e2a\u5377\u4e0a\u6216\u5176\u5b50\u76ee\u5f55\u4e0a\u7684\u6302\u8f7d\u3002\u540c\u6837\u7684\uff0c\u7531\u5bb9\u5668\u521b\u5efa\u7684\u6302\u8f7d\u5728 host \u4e0a\u4e5f\u662f\u4e0d\u53ef\u89c1\u7684\u3002\u8fd9\u662f\u9ed8\u8ba4\u7684\u6a21\u5f0f\u3002\u8fd9\u4e2a\u5176\u5b9e\u5f88\u597d\u7406\u89e3\uff0c\u5c31\u662f\u5bb9\u5668\u5185\u548c host \u7684\u540e\u7eed\u6302\u8f7d\u5b8c\u5168\u9694\u79bb\u3002<\/p>\n<\/li>\n<li>\n<p><code>HostToContainer<\/code>: \u8fd9\u79cd\u5377\u6302\u8f7d\u5c06\u4f1a\u6536\u5230\u4e4b\u540e\u6240\u6709\u7684\u7531 host \u521b\u5efa\u5728\u8be5\u5377\u4e0a\u6216\u5176\u5b50\u76ee\u5f55\u4e0a\u7684\u6302\u8f7d\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u5982\u679c host \u5728\u5377\u6302\u8f7d\u5185\u6302\u8f7d\u7684\u4efb\u4f55\u5185\u5bb9\uff0c\u5728\u5bb9\u5668\u4e2d\u90fd\u662f\u53ef\u89c1\u7684\u3002\u540c\u6837\uff0c\u5982\u679c\u4efb\u4f55\u5177\u6709 <code>Bidirectional<\/code> \u7684 Pod \u6302\u8f7d\u4f20\u64ad\u5230\u8be5\u5377\u6302\u8f7d\u4e0a\uff0c\u5177\u6709 <code>HostToContainer<\/code> \u7684\u6302\u8f7d\u4f20\u64ad\u90fd\u53ef\u4ee5\u770b\u89c1\u3002\u6574\u4e2a\u6302\u8f7d\u4f20\u64ad\u7684\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png\" alt=\"\" \/><\/p>\n<ul>\n<li><code>Bidirectional<\/code>: \u8fd9\u79cd\u6302\u8f7d\u673a\u5236\u548c <code>HostToContainer<\/code> \u7c7b\u4f3c\u3002\u6b64\u5916\uff0c\u4efb\u4f55\u5728\u5bb9\u5668\u4e2d\u521b\u5efa\u7684\u6302\u8f7d\u90fd\u4f1a\u4f20\u64ad\u5230 host\uff0c\u7136\u540e\u4f20\u64ad\u5230\u4f7f\u7528\u76f8\u540c\u5377\u7684\u6240\u6709 Pod \u7684\u6240\u6709\u5bb9\u5668\u3002\u6ce8\u610f\uff1aBidirectional \u6302\u8f7d\u4f20\u64ad\u662f\u5f88\u5371\u9669\u7684\u3002\u53ef\u80fd\u4f1a\u5371\u5bb3\u5230 host \u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u56e0\u6b64\u53ea\u6709\u7279\u6743\u5bb9\u5668\u5728\u5141\u8bb8\u4f7f\u7528\u5b83\u3002<\/li>\n<\/ul>\n<p>\u5728\u4e86\u89e3\u4e86\u8fd9\u51e0\u79cd\u6302\u8f7d\u4f20\u64ad\u4e4b\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u505a\u4e00\u4e9b\u5b9e\u9a8c\u6765\u9a8c\u8bc1\u4e00\u4e0b\uff0c\u9996\u5148\u9a8c\u8bc1\u7684\u662f <code>None<\/code> \u7684\u6302\u8f7d\u4f20\u64ad\u7c7b\u578b\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2a nginx \u7684Pod:<\/p>\n<pre><code class=\"language-yaml line-numbers\">apiVersion: v1\nkind: Pod\nmetadata:\n    name: mount-a\n    namespace: default\n    label:\n      app: mount\nspec:\n    containers:\n    - name: main\n      image: nginx:latest\n      volumeMounts:\n      - name: testmount\n        mountPath: \/home\n        mountPropagation: None\n    volumes:\n    - name: testmount\n      hostPath:\n        path: \/mnt\/\n<\/code><\/pre>\n<p>\u7136\u540e\u6211\u4eec\u5206\u522b\u5411 host \u7684 <code>\/mnt<\/code> \u548c\u5bb9\u5668\u7684 <code>\/home<\/code> \u4e0b\u6302\u8f7d\u76ee\u5f55\u5e76\u67e5\u770b\u5bb9\u5668\u548c host \u7684\u60c5\u51b5\uff1a<\/p>\n<p>\u5bb9\u5668\u4e2d\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ kubectl exec -it mount-a sh\n$ cd \/home\n$ ls \nsda1\n<\/code><\/pre>\n<p>host \u4e0a\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ cd \/mnt\n$ ls \nsda1\n<\/code><\/pre>\n<p>\u7136\u540e\u5728 host \u4e0a\u521b\u5efa\u6302\u8f7d\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ mkdir \/mnt\/none\n$ sudo mount --bind \/var \/mnt\/none\n$ ls none\ncache  empty  lib  lock  log  run  spool  tmp\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u65f6\u5019\uff0c\u6211\u4eec\u518d\u770b\u5bb9\u5668\u4e2d\u7684\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ ls none\n# \u65e0\u8f93\u51fa\n<\/code><\/pre>\n<p>\u8fd9\u8bf4\u660e host \u4e0a\u5728\u8be5\u5377\u4e0b\u7684\u6302\u8f7d\u5e76\u4e0d\u4f1a\u6539\u53d8\u5bb9\u5668\u4e2d\u7684\u6587\u4ef6\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u53ef\u4ee5\u5728\u5bb9\u5668\u4e2d\u6309\u7167\u4e0a\u9762\u7684\u65b9\u6848\u6765\u9a8c\u8bc1\u5bb9\u5668\u4e2d\u7684\u6302\u8f7d\u4e5f\u4e0d\u4f1a\u5f71\u54cd host \u4e2d\u7684\u76ee\u5f55\u89c6\u56fe\u3002\u8fd9\u91cc\u5c31\u4e0d\u5c55\u793a\u4e86\u3002\u63a5\u4e0b\u6765\u770b\u4e00\u4e0b <code>HostToContainer<\/code> \u7684\u6302\u8f7d\u4f20\u64ad\uff0c\u6211\u4eec\u5c06\u4e0a\u9762\u7684 Pod \u7684 <code>mountPropagation<\/code> \u5b57\u6bb5\u6539\u6210 <code>HostToContainer<\/code>\uff0c\u7136\u540e\u5148\u53d6\u6d88 host \u4e0a\u7684\u6302\u8f7d\uff1a<\/p>\n<pre><code class=\"line-numbers\">sudo umoint \/mnt\/none\n<\/code><\/pre>\n<p>\u7136\u540e\u91cd\u65b0\u521b\u5efa Pod\uff0c\u548c\u4e0a\u9762\u4e00\u6837\uff0c\u5728 host \u4e0a\u521b\u5efa\u6302\u8f7d\uff0c\u67e5\u770b\u5bb9\u5668\u4e2d\u7684\u6302\u8f7d\u60c5\u51b5\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ ls none\ncache  empty  lib  lock  log  run  spool  tmp\n<\/code><\/pre>\n<p>host \u4e0a\u7684\u6302\u8f7d\u56e0\u4e3a <code>HostToContainer<\/code> \u673a\u5236\u4f20\u64ad\u5230\u4e86\u5bb9\u5668\u4e2d\u3002\u6211\u4eec\u7ee7\u7eed\u770b\u6700\u540e\u4e00\u79cd <code>Bidirectional<\/code> \u673a\u5236\u3002\u8fd9\u6b21\u6211\u4eec\u8981\u521b\u5efa\u4e24\u4e2a Pod: mount-a, mount-b\uff0c\u5e76\u628a <code>mountPropagation<\/code> \u5b57\u6bb5\u6539\u6210 <code>Bidirectional<\/code>\u3002\u6ce8\u610f\uff0c\u56e0\u4e3a <code>Bidirectional<\/code> \u662f\u5371\u9669\u7684\uff0c\u6240\u4ee5\u53ea\u6709\u7279\u6743\u5bb9\u5668\u624d\u53ef\u4ee5\u4f7f\u7528\u3002\u56e0\u6b64\u8fd9\u91cc\u8fd8\u9700\u8981\u628a\u5bb9\u5668\u6539\u6210\u7279\u6743\u6a21\u5f0f\uff0c\u6700\u540e\u5728 mount-a \u4e2d\u7684\u5bb9\u5668\u6267\u884c\u6302\u8f7d\uff0c\u9a8c\u8bc1\u6302\u8f7d\u662f\u5426\u4f20\u64ad\u5230 host \u548c mount-b \u7684\u5bb9\u5668\u4e2d\u3002<\/p>\n<pre><code class=\"language-yaml line-numbers\">apiVersion: v1\nkind: Pod\nmetadata:\n    name: mount-a\n    namespace: default\n    labels:\n      app: mount\nspec:\n    containers:\n    - name: main\n      image: nginx:latest\n      securityContext:\n        privileged: true\n      volumeMounts:\n      - name: testmount\n        mountPath: \/home\n        mountPropagation: Bidirectional\n    volumes:\n    - name: testmount\n      hostPath:\n        path: \/mnt\/\n---\napiVersion: v1\nkind: Pod\nmetadata:\n    name: mount-b\n    namespace: default\n    labels:\n      app: mount\nspec:\n    containers:\n    - name: main\n      image: nginx:latest\n      securityContext:\n        privileged: true\n      volumeMounts:\n      - name: testmount\n        mountPath: \/home\n        mountPropagation: Bidirectional\n    volumes:\n    - name: testmount\n      hostPath:\n        path: \/mnt\/\n<\/code><\/pre>\n<p>\u7136\u540e\u8fdb\u5165 mount-a\uff0c\u521b\u5efa\u6302\u8f7d\uff1a<\/p>\n<pre><code class=\"language-shell line-numbers\">$ kubectl exec -it mount-a sh\n$ su\n$ mount --bind \/var \/home\/none\n$ ls \/home\/none\nbackups  lib    lock  mail  run    tmp\ncache    local  log   opt   spool\n<\/code><\/pre>\n<p>\u8fd9\u65f6\u5019\u67e5\u770b host \u4e0b\u7684 \/mnt\/none:<\/p>\n<pre><code class=\"language-shell line-numbers\">$ ls \/mnt\/none\nbackups  lib    lock  mail  run    tmp\ncache    local  log   opt   spool\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u53d1\u73b0\uff0c\u5bb9\u5668\u4e2d\u7684\u6302\u8f7d\u4f20\u64ad\u5230\u4e86 host \u4e0a\u3002\u8fd9\u65f6\u5019\u518d\u67e5\u770b mount-b \u4e2d\u7684\u5bb9\u5668\u3002<\/p>\n<pre><code class=\"language-shell line-numbers\">$ ls \/home\/none\nbackups  lib    lock  mail  run    tmp\ncache    local  log   opt   spool\n<\/code><\/pre>\n<p>\u6302\u8f7d\u4e5f\u4f20\u64ad\u5230\u4e86 mount-b \u7684\u5bb9\u5668\u4e2d\u3002<\/p>\n<h2>linux mount \u7684\u51e0\u79cd\u7c7b\u578b<\/h2>\n<p>\u4e0a\u9762\u5206\u6790\u4e86 kubernetes \u7684\u6302\u8f7d\u4f20\u64ad\u673a\u5236\uff0c\u5728 linux mount \u4e2d\uff0c\u4e5f\u6709\u7c7b\u4f3c\u7684\u6982\u5ff5\u3002mount \u5206\u4e3a\u4e0b\u9762\u51e0\u79cd\uff1a<\/p>\n<ul>\n<li>shared mount\uff1a \u76f8\u5f53\u4e8e\u4e0a\u9762\u6240\u8bf4\u7684 <code>Bidirectional<\/code> \u7684\u6302\u8f7d\u4f20\u64ad<\/li>\n<li>slave mount\uff1a \u6bcf\u4e2a slave mount \u90fd\u6709\u4e00\u4e2a shared master mount\uff0c\u6302\u8f7d\u4f20\u64ad\u53ea\u80fd\u4ece master -> slave\uff0c\u7b49\u540c\u4e8e\u4e0a\u9762\u7684 <code>HostToContainer<\/code>\uff0c host \u662f master\uff0ccontainer \u662f slave\u3002<\/li>\n<li>private mount\uff1a \u5f88\u660e\u663e\uff0cprivate \u5c31\u662f\u76f8\u5f53\u4e8e <code>None<\/code>\uff0c\u6302\u8f7d\u4e0d\u4f1a\u5411\u4efb\u4f55\u4e00\u65b9\u4f20\u64ad\u3002<\/li>\n<li>unbindable mount\uff1aunbindable mount \u5176\u5b9e\u5c31\u662f unbindable private mount\uff0c\u4e5f\u5c31\u662f\u4e0d\u5141\u8bb8\u4f7f\u7528 <code>--bind<\/code> \u7684\u6302\u8f7d\u3002<\/li>\n<\/ul>\n<h2>mount namespace \u7684\u673a\u5236<\/h2>\n<p>kubernetes \u7684\u6302\u8f7d\u4f20\u64ad\u4e0d\u662f\u5176\u672c\u8eab\u5b9e\u73b0\u7684\uff0c\u4e5f\u4e0d\u662f docker \u4e4b\u7c7b\u7684\u5bb9\u5668\u8fd0\u884c\u65f6\u63d0\u4f9b\u7684\u3002\u8fd9\u662f\u7531\u5bb9\u5668\u5316\u6280\u672f\u7684\u57fa\u7840\uff1alinux namespace \u63d0\u4f9b\u7684\uff0clinux namespace \u5f53\u524d\u5171\u6709 6 \u79cd:<\/p>\n<ul>\n<li>cgroup namespace: \u9694\u79bb cgroup \u6839\u76ee\u5f55<\/li>\n<li>pid namespace: \u9694\u79bb\u8fdb\u7a0b id<\/li>\n<li>ipc namespace: \u9694\u79bb System V IPC, POSIX message queues<\/li>\n<li>uts namespace: \u9694\u79bb Hostname \u548c NIS domain name<\/li>\n<li>user namespace: \u9694\u79bb\u7528\u6237\u548c\u7528\u6237\u7ec4 ID<\/li>\n<li>mount namespace: \u9694\u79bb\u6302\u8f7d\u70b9<\/li>\n<li>network namespace: \u9694\u79bb\u7f51\u7edc\u8bbe\u5907\uff0c\u7f51\u7edc\u6808\uff0c\u7aef\u53e3\u7b49<\/li>\n<\/ul>\n<p>\u5176\u4e2d\uff0cmount namespace \u662f\u8fd9\u7bc7\u6587\u7ae0\u7684\u91cd\u70b9\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 <code>clone<\/code> \u8c03\u7528\u6765\u770b\u770b mount namespace \u7684\u4f7f\u7528\uff1a<\/p>\n<pre><code class=\"language-c line-numbers\">#define _GNU_SOURCE\n#include &lt;stdio.h&gt;\n#include &lt;sys\/types.h&gt;\n#include &lt;sys\/wait.h&gt;\n#include &lt;sys\/mount.h&gt;\n#include &lt;sched.h&gt;\n#include &lt;signal.h&gt;\n#include &lt;unistd.h&gt;\n\n#define STACK_SIZE (1024*1024)\nstatic char container_stack[STACK_SIZE];\n\nchar* const container_args[] = {\n    \"\/bin\/bash\",\n    NULL\n};\n\nint container_main(void* arg)\n{\n    printf(\"Container [%5d] - inside the container!\\n\", getpid());\n    mount(\"none\", \"\/\", NULL, MS_REC|MS_PRIVATE, NULL);\n    execv(container_args[0], container_args);\n    printf(\"Something's wrong!\\n\");\n    return 1;\n}\nint main()\n{\n    printf(\"Parent [%5d] - start a container!\\n\", getpid());\n    \/* \u542f\u7528Mount Namespace - \u589e\u52a0CLONE_NEWNS\u53c2\u6570 *\/\n    int container_pid = clone(container_main, container_stack+STACK_SIZE, CLONE_NEWNS | SIGCHLD, NULL);\n    waitpid(container_pid, NULL, 0);\n    printf(\"Parent - container stopped!\\n\");\n    return 0;\n}\n<\/code><\/pre>\n<p>\u7f16\u8bd1\u8fd0\u884c:<\/p>\n<pre><code class=\"language-shell line-numbers\">$ gcc main.c -o mount\n$ sudo .\/mount\n<\/code><\/pre>\n<p>\u7136\u540e\u5c1d\u8bd5\u6302\u8f7d\uff0c\u6765\u9a8c\u8bc1\u6302\u8f7d <code>MS_PRIVATE<\/code> \u7684\u6302\u8f7d\u4f20\u64ad\u95ee\u9898\u3002<code>MS_PRIVATE<\/code> \u4e0b namespace \u5185\u548c host \u5e94\u8be5\u662f\u9694\u79bb\u7684\u3002<code>MS_PRIVATE<\/code> \u8fd8\u53ef\u4ee5\u66ff\u6362\u6210 <code>MS_UNBINDABLE<\/code>\uff0c <code>MS_SLAVE<\/code>\uff0c<code>MS_SHARED<\/code>\u3002<\/p>\n<p>\u5173\u4e8e\u66f4\u591a\u7684 namespace \u7684\u8d44\u6599\uff0c\u5efa\u8bae\u770b\u8fd9\u4e24\u7bc7\u6587\u7ae0\uff1a<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/coolshell.cn\/articles\/17010.html\">DOCKER\u57fa\u7840\u6280\u672f\uff1aLINUX NAMESPACE\uff08\u4e0a\uff09<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/coolshell.cn\/articles\/17029.html\">DOCKER\u57fa\u7840\u6280\u672f\uff1aLINUX NAMESPACE\uff08\u4e0b\uff09<\/a><\/li>\n<\/ul>\n<h2>\u53c2\u8003\u8d44\u6599<\/h2>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/man7.org\/linux\/man-pages\/man7\/mount_namespaces.7.html\">MOUNT_NAMESPACES<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/man7.org\/linux\/man-pages\/man7\/namespaces.7.html\">NAMESPACES<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.kernel.org\/doc\/Documentation\/filesystems\/sharedsubtree.txt\">Shared Subtrees<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/coolshell.cn\/articles\/17010.html\">DOCKER\u57fa\u7840\u6280\u672f\uff1aLINUX NAMESPACE\uff08\u4e0a\uff09<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/coolshell.cn\/articles\/17029.html\">DOCKER\u57fa\u7840\u6280\u672f\uff1aLINUX NAMESPACE\uff08\u4e0b\uff09<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/feichashao.com\/kernel-namespace-implementation\/\">Namespace \u5728 Kernel \u91cc\u662f\u600e\u4e48\u5b9e\u73b0\u7684\uff1f\u4ee5 mount namespace \u4e3a\u4f8b<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/storage\/volumes\/#mount-propagation\">Mount propagation<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8ff0 \u4eca\u5929\u5728\u770b kubectl-debug \u8fd9\u4e2a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u770b\u5230\u5176\u90e8\u7f72\u6587\u4ef6\u7684 volumeMounuts \u4e2d\u4f7f &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[],"class_list":["post-596","post","type-post","status-publish","format-standard","hentry","category-k8s"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236 - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"\u6982\u8ff0 \u4eca\u5929\u5728\u770b kubectl-debug \u8fd9\u4e2a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u770b\u5230\u5176\u90e8\u7f72\u6587\u4ef6\u7684 volumeMounuts \u4e2d\u4f7f &hellip; \u7ee7\u7eed\u9605\u8bfbkubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-05T14:39:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T13:28:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236\",\"datePublished\":\"2020-04-05T14:39:15+00:00\",\"dateModified\":\"2023-07-05T13:28:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\"},\"wordCount\":149,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png\",\"articleSection\":[\"k8s\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\",\"name\":\"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png\",\"datePublished\":\"2020-04-05T14:39:15+00:00\",\"dateModified\":\"2023-07-05T13:28:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage\",\"url\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png\",\"contentUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png\",\"width\":485,\"height\":97},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/","og_locale":"zh_CN","og_type":"article","og_title":"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"\u6982\u8ff0 \u4eca\u5929\u5728\u770b kubectl-debug \u8fd9\u4e2a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u770b\u5230\u5176\u90e8\u7f72\u6587\u4ef6\u7684 volumeMounuts \u4e2d\u4f7f &hellip; \u7ee7\u7eed\u9605\u8bfbkubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236","og_url":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2020-04-05T14:39:15+00:00","article_modified_time":"2023-07-05T13:28:56+00:00","og_image":[{"url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png","type":"","width":"","height":""}],"author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236","datePublished":"2020-04-05T14:39:15+00:00","dateModified":"2023-07-05T13:28:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/"},"wordCount":149,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png","articleSection":["k8s"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/","url":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/","name":"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png","datePublished":"2020-04-05T14:39:15+00:00","dateModified":"2023-07-05T13:28:56+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#primaryimage","url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png","contentUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/04\/excalidraw-202033110352-1.png","width":485,"height":97},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2020\/04\/05\/kubernetes-mount-propagation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"kubernetes \u7684\u6302\u8f7d\u4f20\u64ad(mount propagation)\u673a\u5236"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":7632,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=596"}],"version-history":[{"count":2,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/596\/revisions"}],"predecessor-version":[{"id":1548,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/596\/revisions\/1548"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}