我正在學習Kubernetes.
我理解了 Volume 的概念和 Volume 的型別。
但是,我對mouthPath財產感到困惑。按照我的YAML檔案:
apiVersion: v1
kind: Pod
metadata:
name: nginx-alpine-volume
spec:
containers:
- name: nginx
image: nginx:alpine
volumeMounts:
- name: html
mountPath: /usr/share/nginx/html
readOnly: true
resources:
- name: html-updater
image: alpine
command: ["/bin/sh", "-c"]
args:
- while true; do date >> /mohit/index.html;sleep 10; done
resources:
volumeMounts:
- name: html
mountPath: /mohit
volumes:
- name: html
emptyDir: {}
問:mountPath物業有什么用。在這里,我使用一個帶有兩個容器的吊艙。兩個容器具有不同的mounPath值。
更新:

uj5u.com熱心網友回復:
將掛載路徑視為您附加或掛載檔案或系統的目錄
雖然您的實際音量為emptyDir
兩個容器具有不同的安裝路徑的基本想法是什么
因為兩個容器都需要使用不同的檔案夾
由于您的卷是單一名稱 html,因此從卷本地指向或使用不同的檔案夾
兩個容器在它們的安裝點(或檔案夾)管理不同的檔案
所以掛載路徑是你的容器將管理檔案的一個點或直接點。
空目錄:https : //kubernetes.io/docs/concepts/storage/volumes/#emptydir
閱讀更多內容:https : //kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/
如果你看到這個例子:https : //github.com/harsh4870/Kubernetes-wordpress-php-fpm-nginx/blob/master/wordpress-deployment.yaml
它具有相同的兩個容器,帶有掛載路徑和emptydir卷
我正在做的是將 Nginx 組態檔附加到容器,以便 Nginx 將使用我從外部安裝到容器的組態檔。
我的組態檔存盤在configmap或secret 中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/344448.html
標籤:码头工人 Kubernetes 体积
下一篇:作業目錄中沒有這樣的檔案或目錄
