2017-02-06 5 views

Antwort

10

Sie ein ConfigMap-Objekt erstellen und dann die Werte als Dateien montieren, wo Sie sie brauchen:

apiVersion: v1 
kind: ConfigMap 
metadata: 
    name: nginx-config 
data: 
    nginx.conf: | 
    your config 
    comes here 
    like this 
    other.conf: | 
    second file 
    contents 

und in dir pod spec:

spec: 
    containers: 
    - name: nginx 
     image: nginx 
     volumeMounts: 
     - name: nginx-config 
      mountPath: /etc/nginx/nginx.conf 
      subPath: nginx.conf 
     - name: nginx-config 
      mountPath: /etc/nginx/other.conf 
      subPath: other.conf 
    volumes: 
    - name: nginx-config 
     configMap: 
     name: nginx-config 

(Anmerkung der Vervielfältigung des Takes Dateiname in mountPath und Verwendung des genau gleichen Unterpfads; dasselbe gilt für Befestigungsdateien.)

Weitere Informationen zu ConfigMap finden Sie unter: https://kubernetes.io/docs/user-guide/configmap/

Verwandte Themen