在我的kustomization.yaml
我有:
...
secretGenerator:
- name: db-env
behavior: create
envs:
- my.env
patchesStrategicMerge:
- app.yaml
然后在我app.yaml
的(补丁)中我有:
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deployment
spec:
template:
spec:
containers:
- name: server
envFrom:
- secretRef:
name: db-env
当我尝试通过以下方式构建它时,kustomize build k8s/development
我退出了:
apiVersion: apps/v1
kind: Deployment
...
spec:
containers:
- envFrom:
- secretRef:
name: db-env
name: server
什么时候应该:
- envFrom:
- secretRef:
name: db-env-4g95hhmhfc
如何让secretGenerator
名称哈希也适用patchesStrategicMerge
?
或者,将一些环境变量注入到特定覆盖的部署中的正确方法是什么?
这是为了发展。
我的文件结构是这样的:
❯ tree k8s
k8s
├── base
│ ├── app.yaml
│ └── kustomization.yaml
├── development
│ ├── app.yaml
│ ├── golinks.sql
│ ├── kustomization.yaml
│ ├── mariadb.yaml
│ ├── my.cnf
│ └── my.env
└── production
├── ingress.yaml
└── kustomization.yaml
在哪里base/kustomization.yaml
:
namespace: go-mpen
resources:
- app.yaml
images:
- name: server
newName: reg/proj/server
并且development/kustomization.yaml
是:
resources:
- ../base
- mariadb.yaml
configMapGenerator:
- name: mariadb-config
files:
- my.cnf
- name: initdb-config
files:
- golinks.sql # TODO: can we mount this w/out a config file?
secretGenerator:
- name: db-env
behavior: create
envs:
- my.env
patchesStrategicMerge:
- app.yaml