Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 从Spring引导应用程序Kubernetes访问NFS卷装载_Spring Boot_Kubernetes_Nfs - Fatal编程技术网

Spring boot 从Spring引导应用程序Kubernetes访问NFS卷装载

Spring boot 从Spring引导应用程序Kubernetes访问NFS卷装载,spring-boot,kubernetes,nfs,Spring Boot,Kubernetes,Nfs,我已经将NFS卷装载添加到运行在Kubernetes上的Spring引导容器中。下面是我的Kubernetes部署文件 apiVersion: apps/v1 kind: Deployment metadata: labels: app: ldap spec: replicas: 3 spec: serviceAccountName: xxx-staging-take-poc-admin volumes: - name: n

我已经将NFS卷装载添加到运行在Kubernetes上的Spring引导容器中。下面是我的Kubernetes部署文件

apiVersion: apps/v1
kind: Deployment
metadata: 
  labels: 
    app: ldap
spec: 
  replicas: 3
    spec: 
      serviceAccountName: xxx-staging-take-poc-admin
      volumes:
        - name: nfs-volume
          nfs:
           server: 10.xxx.xxx.xxx
           path: /ifs/standard/take1-poc 
      containers: 
        - 
          image: image-id
          volumeMounts:
            - name: nfs-volume
              mountPath: /var/nfs
          name: ldap

如何从Spring引导应用程序访问装载路径以实现文件读写。

如果我理解正确,您可以通过环境变量将外部信息传递给sprint引导应用程序。这是一篇关于如何做的更详细信息的文章

Kubernetes ConfigMaps还允许我们将文件作为ConfigMap加载 财产。这为我们提供了一个加载弹簧的有趣选项 通过Kubernetes ConfigMaps引导application.properties

此外,您可能还需要熟悉。它展示了如何引用同样挂载的秘密,这样您可能会发现它对您的情况很有帮助

Spring Cloud Kubernetes插件实现了 Kubernetes和弹簧靴。原则上,您可以访问 使用Kubernetes API从ConfigMap获取配置数据

如果有帮助,请告诉我