{"id":103,"date":"2024-03-06T18:56:00","date_gmt":"2024-03-06T10:56:00","guid":{"rendered":"https:\/\/www.xueyaa.top\/?p=103"},"modified":"2026-03-08T18:13:26","modified_gmt":"2026-03-08T10:13:26","slug":"%e5%ad%98%e5%82%a8%e5%8d%b7-hostpath%e3%80%81configmap","status":"publish","type":"post","link":"https:\/\/www.xueyaa.top\/?p=103","title":{"rendered":"\u5b58\u50a8\u5377\u2014\u2014hostPath\u3001configMap"},"content":{"rendered":"\n<h1 class=\"wp-block-heading has-large-font-size\" id=\"gYW7w\"><strong>1.hostPath\u5b58\u50a8\u5377<\/strong><\/h1>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/cdn.nlark.com\/yuque\/0\/2026\/png\/29112972\/1768746534380-50654fcd-6087-47c7-9af7-c9fc9fb03e1a.png\" alt=\"\" style=\"aspect-ratio:3.228139258703669;width:432px;height:auto\" title=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/cdn.nlark.com\/yuque\/0\/2026\/png\/29112972\/1768746913502-b0c0494f-53b2-4769-849a-12c6ff23116d.png\" alt=\"\" style=\"aspect-ratio:2.2938424188920767;width:431px;height:auto\" title=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"jSSo6\"><strong>1.1hostPath\u6982\u8ff0<\/strong><\/h2>\n\n\n\n<p id=\"u739da311\">hostPath\u5b58\u50a8\u5377\u7684\u5e94\u7528\u573a\u666f\u662f: \u5bb9\u5668\u8bbf\u95eeworker\u8282\u70b9\u4efb\u610f\u5de5\u4f5c\u76ee\u5f55\u7684\u60c5\u51b5\u3002<code>hostPath<\/code> \u5c06Pod\u4e0e\u7279\u5b9a\u8282\u70b9\u7ed1\u5b9a\uff0c\u7834\u574f\u4e86K8s\u7684&#8221;\u53ef\u8c03\u5ea6\u6027&#8221;\u539f\u5219\uff0c\u4ec5\u5728\u5fc5\u8981\u65f6\u4f7f\u7528\u3002(\u610f\u601d\u5c31\u662f232\u8282\u70b9\u7684pod\u5c31\u4e0d\u80fd\u8bbf\u95ee233\u8282\u70b9\u5bbf\u4e3b\u673a\u7684\u76ee\u5f55)<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e5f\u53ef\u4ee5\u5c06\u5bbf\u4e3b\u673a\u65f6\u95f4\u548c\u5bb9\u5668\u65f6\u95f4\u8fdb\u884c\u540c\u6b65\u3002\u5220\u9664pod,\u6570\u636e\u4e0d\u4e22\u5931<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"rCNs5\"><strong>1.2\u5bb9\u5668\u8bbf\u95eeworker\u5bbf\u4e3b\u673a\u6848\u4f8b<\/strong><\/h2>\n\n\n\n<pre id=\"nlekm\" class=\"wp-block-code\"><code>\t1.\u521b\u5efa\u8d44\u6e90\n&#91;root@master231 deployments]# cat 04-deploy-volumes-hostPath.yaml\napiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: deploy-volumes-hostpath\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      apps: xiuxian\n  template: \n    metadata:\n      labels:\n         apps: xiuxian\n         version: v1\n    spec:\n      volumes:\n      - name: xixi\n        # \u58f0\u660e\u5b58\u50a8\u5377\u7c7b\u578b\n        hostPath:\n          # \u6307\u5b9a\u5bbf\u4e3b\u673a\u7684\u8def\u5f84\uff0c\u5982\u679c\u5bbf\u4e3b\u673a\u8def\u5f84\u4e0d\u5b58\u5728\uff0c\u9ed8\u8ba4\u4f1a\u81ea\u52a8\u521b\u5efa\n          path: \/data\n      containers:\n      - name: c1\n        image: registry.cn-hangzhou.aliyuncs.com\/yinzhengjie-k8s\/apps:v1\n        volumeMounts:\n        - name: xixi\n          mountPath: \/oldboyedu\n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# kubectl apply -f  04-deploy-volumes-hostPath.yaml\ndeployment.apps\/deploy-volumes-hostpath created\n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# kubectl get pods -o wide\nNAME                                       READY   STATUS    RESTARTS   AGE   IP             NODE        NOMINATED NODE   READINESS GATES\ndeploy-volumes-hostpath-6798f4784c-4cc8h   1\/1     Running   0          4s    10.100.1.169   worker232   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-6798f4784c-7rlzm   1\/1     Running   0          4s    10.100.2.150   worker233   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-6798f4784c-fr74r   1\/1     Running   0          4s    10.100.1.168   worker232   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-6798f4784c-rghb5   1\/1     Running   0          4s    10.100.2.151   worker233   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-6798f4784c-w826c   1\/1     Running   0          4s    10.100.2.149   worker233   &lt;none&gt;           &lt;none&gt;\n&#91;root@master231 deployments]# \n\n\n\t2.\u8bbf\u95ee\u6d4b\u8bd5\n&#91;root@master231 deployments]# kubectl exec -it deploy-volumes-hostpath-6798f4784c-4cc8h -- sh   #\u5728232\u8282\u70b9\u4fee\u6539\u7684\n\/ # \n\/ # ls -l \/oldboyedu\/\ntotal 0\n\/ # \n\/ # echo www.oldboyedu.com  &gt; \/oldboyedu\/index.html\n\/ # \n\/ # ls -l \/oldboyedu\/\ntotal 4\n-rw-r--r--    1 root     root            18 Dec  3 03:59 index.html\n\/ # \n\/ # cat \/oldboyedu\/index.html \nwww.oldboyedu.com\n\/ # \n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# kubectl exec  deploy-volumes-hostpath-6798f4784c-fr74r  -- cat \/oldboyedu\/index.html  # \u8be5pod\u5728worker232\u8282\u70b9\nwww.oldboyedu.com\n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# kubectl exec  deploy-volumes-hostpath-6798f4784c-w826c  -- cat \/oldboyedu\/index.html   # \u8be5Pod\u4e0d\u5728worker232\u8282\u70b9\ncat: can\u2019t open '\/oldboyedu\/index.html': No such file or directory\ncommand terminated with exit code 1\n&#91;root@master231 deployments]#  \n\n\n\t3.\u5220\u9664\u8d44\u6e90\n&#91;root@master231 deployments]# kubectl delete -f 04-deploy-volumes-hostPath.yaml \ndeployment.apps \"deploy-volumes-hostpath\" deleted\n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# kubectl get pods\nNo resources found in default namespace.\n&#91;root@master231 deployments]# \n\n\t\n\t4.\u9a8c\u8bc1worker\u8282\u70b9\u6570\u636e\n&#91;root@worker232 ~]# ll \/data\ntotal 12\ndrwxr-xr-x  2 root root 4096 Dec  3 11:59 .\/\ndrwxr-xr-x 22 root root 4096 Dec  3 11:59 ..\/\n-rw-r--r--  1 root root   18 Dec  3 11:59 index.html\n&#91;root@worker232 ~]#  \n&#91;root@worker232 ~]# cat \/data\/index.html \nwww.oldboyedu.com\n\n&#91;root@worker233 ~]# ll \/data    #\u5728232\u8282\u70b9\u624d\u6709\ntotal 8\ndrwxr-xr-x  2 root root 4096 Dec  3 11:59 .\/\ndrwxr-xr-x 22 root root 4096 Dec  3 11:59 ..\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"qRTgj\"><strong>1.3\u5bb9\u5668\u548c\u5bbf\u4e3b\u673a\u540c\u6b65\u65f6\u533a<\/strong><\/h2>\n\n\n\n<pre id=\"u8Itk\" class=\"wp-block-code\"><code>\t1.\u7f16\u5199\u8d44\u6e90\u5e76\u521b\u5efa\u8d44\u6e90\n&#91;root@master231 deployments]# cat 05-deploy-volumes-hostPath.yaml \napiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: deploy-volumes-hostpath\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      apps: xiuxian\n  template: \n    metadata:\n      labels:\n         apps: xiuxian\n         version: v1\n    spec:\n      volumes:\n      - name: xixi\n        # \u58f0\u660e\u5b58\u50a8\u5377\u7c7b\u578b\n        hostPath:\n          # \u6307\u5b9a\u5bbf\u4e3b\u673a\u7684\u8def\u5f84\uff0c\u5982\u679c\u5bbf\u4e3b\u673a\u8def\u5f84\u4e0d\u5b58\u5728\uff0c\u9ed8\u8ba4\u4f1a\u81ea\u52a8\u521b\u5efa\n          path: \/data\n      - name: haha\n        hostPath:\n          path: \/etc\/localtime\n      containers:\n      - name: c1\n        image: registry.cn-hangzhou.aliyuncs.com\/yinzhengjie-k8s\/apps:v1\n        volumeMounts:\n        - name: xixi\n          mountPath: \/oldboyedu\n        - name: haha\n          #\u5bb9\u5668\u4e2d\u9ed8\u8ba4\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\n          mountPath: \/etc\/localtime\n&#91;root@master231 deployments]# \n\n\t2.\u521b\u5efa\u8d44\u6e90\n&#91;root@master231 deployments]# kubectl apply -f  05-deploy-volumes-hostPath.yaml \ndeployment.apps\/deploy-volumes-hostpath created\n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# kubectl get pods -o wide\nNAME                                       READY   STATUS    RESTARTS  AGE   IP             NODE        NOMINATED NODE   READINESS GATES\ndeploy-volumes-hostpath-5ff5bb85b7-4lghw   1\/1     Running   0         3s    10.100.2.160   worker233   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-5ff5bb85b7-5cfxb   1\/1     Running   0         3s    10.100.2.158   worker233   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-5ff5bb85b7-65wjx   1\/1     Running   0         3s    10.100.2.159   worker233   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-5ff5bb85b7-8xnbl   1\/1     Running   0         3s    10.100.1.174   worker232   &lt;none&gt;           &lt;none&gt;\ndeploy-volumes-hostpath-5ff5bb85b7-j5ljs   1\/1     Running   0         3s    10.100.1.175   worker232   &lt;none&gt;           &lt;none&gt;\n&#91;root@master231 deployments]# \n\n\t3.\u67e5\u770bpod\u7684\u65f6\u95f4\n&#91;root@master231 deployments]# kubectl exec deploy-volumes-hostpath-5ff5bb85b7-4lghw -- date -R\nWed, 03 Dec 2025 12:05:43 +0800\n&#91;root@master231 deployments]# \n&#91;root@master231 deployments]# date -R\nWed, 03 Dec 2025 12:05:48 +0800\n\n\n\t4.\u5220\u9664\u8d44\u6e90\n&#91;root@master231 deployments]# kubectl delete -f 05-deploy-volumes-hostPath.yaml \ndeployment.apps \"deploy-volumes-hostpath\" deleted\n&#91;root@master231 deployments]# <\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\"><strong>2.configMap\u914d\u7f6e\u7ba1\u7406(\u5b58\u50a8\u5377\u8fdb\u9636)<\/strong><\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\" id=\"tz4UB\"><strong>2.1\u4ec0\u4e48\u662fconfigMap\uff1f<\/strong><\/h1>\n\n\n\n<p id=\"u5b926ab6\">&#8220;cm&#8221;\u662fconfigMap\u7684\u7b80\u79f0\uff0c\u4e3b\u8981\u5b58\u50a8\u7684\u662f\u914d\u7f6e\u4fe1\u606f\uff0c\u53ea\u8981\u662f\u914d\u7f6e\u76f8\u5173\u7684\u4fe1\u606f\u90fd\u53ef\u4ee5\u7528\u8be5\u8d44\u6e90\u5b9a\u4e49\u3002<\/p>\n\n\n\n<p id=\"u661860df\">cm\u8d44\u6e90\u5b58\u50a8\u5728etcd\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n\n\n\n<p id=\"u7da558f8\">cm\u8d44\u6e90\u53ef\u4ee5\u88abk8s\u7684pod\u4ee5\u73af\u5883\u53d8\u91cf\u7684\u65b9\u5f0f\u6ce8\u5165\uff0c\u4e5f\u53ef\u4ee5\u57fa\u4e8e\u5b58\u50a8\u5377\u7684\u65b9\u5f0f\u6ce8\u5165\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"iMvVC\"><strong>2.2cm\u7684\u57fa\u672c\u7ba1\u7406<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"FfP25\">1\uff09\u54cd\u5e94\u5f0f\u7ba1\u7406cm<\/h3>\n\n\n\n<pre id=\"AGmes\" class=\"wp-block-code\"><code>\t1.\u521b\u5efacm\u8d44\u6e90\n&#91;root@master231 ~]# kubectl create configmap xixi --from-file=myhosts=\/etc\/hosts --from-file=myfstab=\/etc\/fstab --from-literal=school=oldboyedu --from-literal=class=linux101 \nconfigmap\/xixi created\n#\u8981\u5584\u4e8e\u5229\u7528\u5e2e\u52a9\u624b\u518c\n&#91;root@master231 ~]# kubectl create configmap --help\n\n\u76f8\u5173\u53c2\u6570\u8bf4\u660e:\n\t--from-file\uff1a\n\t\t\u4ece\u672c\u5730\u6587\u4ef6\u8bfb\u53d6\u6570\u636e\u4f5c\u4e3a\u5185\u5bb9\uff0ckey\u53ef\u4ee5\u81ea\u5b9a\u4e49\u3002\n\t\t\n\t--from-literal\n\t\t\u81ea\u5b9a\u4e49key\u548cvalue\u3002\n\t\t\n\t2.\u67e5\u770b\u8d44\u6e90\n&#91;root@master231 ~]# kubectl get cm\nNAME               DATA   AGE\nkube-root-ca.crt   1      3d5h\nxixi               4      1s\n&#91;root@master231 ~]# \n\n\n\t3.\u67e5\u770bcm\u8d44\u6e90\u7684\u8be6\u7ec6\u4fe1\u606f\n&#91;root@master231 ~]# kubectl describe cm xixi \nName:         xixi\nNamespace:    default\nLabels:       &lt;none>\nAnnotations:  &lt;none>\n\nData\n====\nclass:\n----\nlinux101\nmyfstab:\n----\n# \/etc\/fstab: static file system information.\n#\n# Use 'blkid' to print the universally unique identifier for a\n# device; this may be used with UUID= as a more robust way to name devices\n# that works even if disks are added and removed. See fstab(5).\n#\n# &lt;file system> &lt;mount point>   &lt;type>  &lt;options>       &lt;dump>  &lt;pass>\n# \/ was on \/dev\/ubuntu-vg\/ubuntu-lv during curtin installation\n\/dev\/disk\/by-id\/dm-uuid-LVM-bnHAqpuXu82FBpioU8vuL2VHJrbRd5htZ2cCu4oaG9KR6WhEsT7eOyWGYrsz1L1N \/ ext4 defaults 0 1\n# \/boot was on \/dev\/sda2 during curtin installation\n\/dev\/disk\/by-uuid\/1ed39505-7b9d-46a1-af6d-67d05107e9df \/boot ext4 defaults 0 1\n#\/swap.img  none  swap  sw  0  0\n\nmyhosts:\n----\n127.0.0.1 localhost\n127.0.1.1 yinzhengjie\n\n# The following lines are desirable for IPv6 capable hosts\n::1     ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\n10.0.0.250 harbor250.oldboyedu.com\n\nschool:\n----\noldboyedu\n\nBinaryData\n====\n\nEvents:  &lt;none>\n&#91;root@master231 ~]# \n\n\n\t4.\u7f16\u8f91\u8d44\u6e90\n&#91;root@master231 ~]# kubectl edit cm xixi  # \u4f7f\u7528'wq'\u8fdb\u884c\u4fdd\u5b58\u5e76\u9000\u51fa\uff0c\u548cvim\u547d\u4ee4\u7c7b\u4f3c\u3002\nconfigmap\/xixi edited\n&#91;root@master231 ~]# \n\t\n\t5.\u5220\u9664cm\u8d44\u6e90\n&#91;root@master231 ~]# kubectl delete cm xixi \nconfigmap \"xixi\" deleted\n&#91;root@master231 ~]# \n&#91;root@master231 ~]# kubectl get cm\nNAME               DATA   AGE\nkube-root-ca.crt   1      3d5h\n&#91;root@master231 ~]# <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"LAxDQ\">2\uff09\u58f0\u660e\u5f0f\u7ba1\u7406cm<\/h3>\n\n\n\n<pre id=\"qyAvV\" class=\"wp-block-code\"><code>\t1 \u7f16\u5199\u8d44\u6e90\u6e05\u5355\n&#91;root@master231 configmaps]# cat 01-cm-conf.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cm-conf\ndata:\n  school: oldboyedu\n  class: linux101\n\n  my.cnf: |<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"MrJlm\"><strong>2.3configMap\u5b9e\u73b0\u914d\u7f6e\u4e2d\u5fc3\u6848\u4f8b<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u914d\u7f6e\u4e2d\u5fc3\uff1a\u4e00\u4e2apod\u5c31\u76f8\u5f53\u4e8e1\u4e2a\u670d\u52a1\u5668\uff0c3\u526f\u672c,\u90fd\u662f\u76d1\u542c90\u7aef\u53e3,\u76f8\u5f53\u4e8eweb\u96c6\u7fa4<\/li>\n<\/ul>\n\n\n\n<pre id=\"rhyWN\" class=\"wp-block-code\"><code>\t1 \u7f16\u5199\u8d44\u6e90\u6e05\u5355\n&#91;root@master231 configmaps]# cat 04-deploy-cm-xiuxian.yaml \napiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: deploy-xiuxian\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: xiuxian\n  template:\n    metadata:\n      labels:\n        app: xiuxian\n        version: v1\n    spec:\n      volumes:\n      - name: datetime\n        hostPath:\n          path: \/etc\/localtime\n      - name: data\n        configMap:\n          name: cm-nginx\n          items:\n          - key: default.conf\n            path: xiuxian.conf\n      containers:\n      - name: c1\n        image: registry.cn-hangzhou.aliyuncs.com\/yinzhengjie-k8s\/apps:v1\n        volumeMounts:\n        - name: data\n          mountPath: \/etc\/nginx\/conf.d\/\n        - name: datetime\n          mountPath: \/etc\/localtime\n\n---\n\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cm-nginx\ndata:\n  default.conf: |\n    server {\n        listen       91;\n        listen  &#91;::]:91;\n        server_name  localhost;\n        location \/ {\n            root   \/usr\/share\/nginx\/html;\n            index  index.html index.htm;\n        }\n        error_page   500 502 503 504  \/50x.html;\n        location = \/50x.html {\n            root   \/usr\/share\/nginx\/html;\n        }\n    }\n\n&#91;root@master231 configmaps]# \n\n\n\t2 \u6d4b\u8bd5\u9a8c\u8bc1 \n&#91;root@master231 configmaps]# kubectl apply -f  04-deploy-cm-xiuxian.yaml \ndeployment.apps\/deploy-xiuxian created\nconfigmap\/cm-nginx created\n&#91;root@master231 configmaps]# \n&#91;root@master231 configmaps]# kubectl get pods -o wide\nNAME                             READY   STATUS    RESTARTS   AGE   IP             NODE        NOMINATED NODE   READINESS GATES\ndeploy-xiuxian-7f76dd69c-4x86b   1\/1     Running   0          3s    10.100.1.189   worker232   &lt;none&gt;           &lt;none&gt;\ndeploy-xiuxian-7f76dd69c-k9k7p   1\/1     Running   0          3s    10.100.2.173   worker233   &lt;none&gt;           &lt;none&gt;\ndeploy-xiuxian-7f76dd69c-s5wj8   1\/1     Running   0          3s    10.100.1.190   worker232   &lt;none&gt;           &lt;none&gt;\n&#91;root@master231 configmaps]# \n&#91;root@master231 configmaps]# curl 10.100.1.189 # \u5f88\u660e\u663e\uff0c\u9ed8\u8ba4\u768480\u7aef\u53e3\u4e0d\u751f\u6548\u5566\uff01\ncurl: (7) Failed to connect to 10.100.1.189 port 80 after 0 ms: Connection refused\n&#91;root@master231 configmaps]# \n&#91;root@master231 configmaps]# curl 10.100.1.189:91\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;meta charset=\"utf-8\"\/&gt;\n    &lt;title&gt;yinzhengjie apps v1&lt;\/title&gt;\n    &lt;style&gt;\n       div img {\n          width: 900px;\n          height: 600px;\n          margin: 0;\n       }\n    &lt;\/style&gt;\n  &lt;\/head&gt;\n\n  &lt;body&gt;\n    &lt;h1 style=\"color: green\"&gt;\u51e1\u4eba\u4fee\u4ed9\u4f20 v1 &lt;\/h1&gt;\n    &lt;div&gt;\n      &lt;img src=\"1.jpg\"&gt;\n    &lt;div&gt;\n  &lt;\/body&gt;\n\n&lt;\/html&gt;\n&#91;root@master231 configmaps]# \n&#91;root@master231 configmaps]# kubectl exec -it deploy-xiuxian-7f76dd69c-4x86b -- sh\n\/ # \n\/ # ls -l \/etc\/nginx\/conf.d\/  # \u4e4b\u524d\u7684default\u6587\u4ef6\u88ab\u8986\u76d6\u4e86\uff01\ntotal 0\nlrwxrwxrwx    1 root     root            19 Dec  3 16:42 xiuxian.conf -&gt; ..data\/xiuxian.conf\n\/ # \n\/ # cat  \/etc\/nginx\/conf.d\/xiuxian.conf \nserver {\n    listen       91;\n    listen  &#91;::]:91;\n    server_name  localhost;\n    location \/ {\n        root   \/usr\/share\/nginx\/html;\n        index  index.html index.htm;\n    }\n    error_page   500 502 503 504  \/50x.html;\n    location = \/50x.html {\n        root   \/usr\/share\/nginx\/html;\n    }\n}\n\/ # \n\n\t3.\u5220\u9664\u8d44\u6e90\n&#91;root@master231 configmaps]# kubectl delete -f 04-deploy-cm-xiuxian.yaml \ndeployment.apps \"deploy-xiuxian\" deleted\nconfigmap \"cm-nginx\" deleted<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"xDuKy\">\u603b\u7ed3<\/h1>\n\n\n\n<pre id=\"nrXMT\" class=\"wp-block-code\"><code>- hostPath\u5b58\u50a8\u5377\n\n- configMap\n   - \u5f88\u7075\u6d3b,\u5982\u4e00\u4e2a\u955c\u50cf\u4e2d\u7684\u914d\u7f6e\u6587\u4ef6\u5199\u6b7b\u4e86,\u5728\u4e0d\u9700\u8981\u6253\u955c\u50cf\u7684\u60c5\u51b5\u4e0b,\u5c31\u53ef\u4ee5\u901a\u8fc7cm\u6302\u8f7d\u5230\u5bb9\u5668\u4e2d\u4ece\u800c\u4fee\u6539\u3002<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.hostPath\u5b58\u50a8\u5377 1.1hostPath\u6982\u8ff0 hostPath\u5b58\u50a8\u5377\u7684\u5e94\u7528\u573a\u666f\u662f: \u5bb9\u5668\u8bbf\u95eework [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":104,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":1,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":105,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions\/105"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=\/wp\/v2\/media\/104"}],"wp:attachment":[{"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xueyaa.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}