将 Kubernetes Ingress Controller 与 postgres 数据库一起使用时,如何向其中添加自定义实体?

问题描述

标题。我让 Kong 与 Kubernetes Ingress Controller 一起运行。我已经有一个有效的自定义插件。我尝试将迁移文件添加到我的插件文件中,其中包含适当的迁移,但子目录被 kubectl create configmap 忽略并且 -R 标志不起作用。

解决方法

很遗憾,目前不支持此功能。解决此限制的方法是在 YAML 中创建一个卷,以便为子文件夹中的文件定义路径,如下所示:

apiVersion: v1
kind: ConfigMap
metadata:
   name: testconfig
data:
  file1: |
    This is file1
  file2: |
    This is file2 in subdir directory
---

然后在 YAML 的卷部分中,您将使用名称指定文件的路径

  volumes:
    - name: config-volume
      configMap:
        name: testconfig
        items:
        - key: file2
          path: subdir/file2
        - key: file1
          path: file1

您可以使用 initContainers 和 emptyDir 挂载来做到这一点,方法是将信息从 initContainer 传递给应用程序,如here