相关疑难解决方法(0)

如何在kubernetes中使用卷装置合并两个配置映射

我有两个不同的配置映射test-configmapcommon-config.我试图将它们安装在同一个位置,但是一个配置图覆盖了另一个.然后我读到subPath并且没有工作.

deploy.yaml

apiVersion: apps/v1beta1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
  name: testing
spec:
  replicas: 1
  template:
    metadata:
      name: testing
      labels:
        app: testing
    spec:
      containers:
      - name: testing-container
        image: testing
        imagePullPolicy: IfNotPresent
      ports:
      - containerPort: __PORT__
      volumeMounts:
      - name: commonconfig-volume
        mountPath: /usr/src/app/config/test.config
        subPath: test.config
    volumes:
      - name: commonconfig-volume
        configMap:
          name: test-configmap
      - name: commonconfig-volume
        configMap:
          name: common-config
Run Code Online (Sandbox Code Playgroud)

错误:

The Deployment "testing" is invalid: spec.template.spec.volumes[1].name: Duplicate value: "commonconfig-volume"

我不确定合并两个配置图是否可以实现.如果是,那么我该怎么办呢.

deployment kubernetes

6
推荐指数
3
解决办法
6538
查看次数

将conf文件嵌入舵图

我是掌舵人。我用大量的conf文件构建了一个混乱的头盔图表。我目前在configmap中使用类似的东西..

    apiVersion: v1
kind: ConfigMap
metadata:
  name: splunk-master-configmap
data:
  indexes.conf: |
    # global settings
    # Inheritable by all indexes: no hot/warm bucket can exceed 1 TB.
    # Individual indexes can override this setting.
    homePath.maxDataSizeMB = 1000000
Run Code Online (Sandbox Code Playgroud)

但是我更喜欢将conf文件放在单独的文件夹中,例如configs / helloworld.conf,并且跨过“ tpl”,但是正在努力了解如何实现它。-任何人都可以建议最佳做法。附带说明一下,splunk的出现顺序为>>,因此可能在不同位置使用了许多index.conf文件。有没有人对如何最好地实现这一目标有任何想法?

干杯。

templates splunk kubernetes kubernetes-helm configmap

2
推荐指数
1
解决办法
3248
查看次数

从舵配置获取字符串数组

最终,我试图['foo', 'bar']从头盔配置中获取一个字符串数组,例如在我的js应用程序中。

./vars/dev/organizations.yaml

...
organizations:
  - 'foo'
  - 'bar'
...
Run Code Online (Sandbox Code Playgroud)

./templates/configmap.yaml

...
data:
  organizations.yaml: |
    organizations: "{{ toYaml .Values.organizations | indent 4 }}"
...
Run Code Online (Sandbox Code Playgroud)

./templates/deployment.yaml

...
containers:
    args:
       - "--organizations-config"
       - "/etc/app/cfg/organizations.yaml"
...
Run Code Online (Sandbox Code Playgroud)

index.js

...
const DEFAULT_ORGANIZATIONS_PATH = './vars/local/organizations.yaml'
const program = require('commander')

program
  .option(
    '--organizations-config <file path>',
    'The path to the organizations config file.', DEFAULT_ORGANIZATIONS_PATH)
  .parse(process.argv)

function readConfigs () {
  return Promise.all(configs.map(path => {
    return new Promise((resolve, reject) => {
      fs.readFile(path, (err, data) => {
        err ? …
Run Code Online (Sandbox Code Playgroud)

kubernetes kubernetes-helm

2
推荐指数
2
解决办法
2685
查看次数