部署后用于挂载NFS路径的Pod / Container目录为空

时间:2020-06-18 19:26:53

标签: kubernetes openshift nfs persistent-storage okd

以下是我的kubernetes / openshift部署,pv和pvc-yaml模板:

apiVersion: v1
kind: DeploymentConfig
metadata:
  name: pythonApp
  creationTimestamp: null
  annotations:
    openshift.io/image.insecureRepository: "true"
spec:
  replicas: 1
  strategy:
    type: Recreate
  revisionHistoryLimit: 2
  template:
    metadata:
      labels:
        app: pythonApp
      creationTimestamp: null
    spec:
      hostAliases:
        - ip: "127.0.0.1"
          hostnames:
            - "backend"
      containers:
        - name: backend
          imagePullPolicy: IfNotPresent
          image: <img-name>
          command: ["sh", "-c"]
          args: ['python manage.py runserver']
          resources: {}
          volumeMounts:
          - mountPath: /pythonApp/configs
            name: configs
      restartPolicy: Always
      volumes:
      - name: configs
        persistentVolumeClaim:
          claimName: "configs-volume"
status: {}

---------------------------------------------------------------

apiVersion: v1
kind: PersistentVolume
metadata:
  name: "configs-volume"
  storageClassName: manual
  capacity:
    storage: 1Gi
  persistentVolumeReclaimPolicy: Retain
  accessModes:
  - ReadWriteMany
  nfs:
    path: /mnt/k8sMount/configs
    server: <server-ip>

---------------------------------------------------------------

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: "configs-volume-claim"
  creationTimestamp: null
spec:
  storageClassName: manual
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  volumeName: "configs-volume"

在部署之后,我exec在容器内(使用oc execkubectl exec命令并检查文件夹/pythonApp/configs时,发现它为空。实际上,应该使用的映像中包含一些配置文件。

由于/pythonApp/configs导致的此问题是否已安装到持久性nfs卷安装路径/mnt/k8sMount/configs上,该路径最初将为空?该如何解决?

Kubernetes版本:1.11 Openshift版本:3.11

0 个答案:

没有答案
相关问题