如何在 Helm NginX Ingress 控制器中使用 ConfigMap 配置 - Kubernetes [英] How to use ConfigMap configuration with Helm NginX Ingress controller - Kubernetes

查看:25
本文介绍了如何在 Helm NginX Ingress 控制器中使用 ConfigMap 配置 - Kubernetes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了有关如何使用 ConfigMap 配置 NginX 入口控制器的文档:https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/

I've found a documentation about how to configure your NginX ingress controller using ConfigMap: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/

不幸的是,我不知道也找不到如何从我的 Ingress 控制器加载 ConfigMap.

Unfortunately I've no idea and couldn't find it anywhere how to load that ConfigMap from my Ingress controller.

我的入口控制器:

helm install --name ingress --namespace ingress-nginx --set rbac.create=true,controller.kind=DaemonSet,controller.service.type=ClusterIP,controller.hostNetwork=true stable/nginx-ingress

我的配置图:

kind: ConfigMap
apiVersion: v1
metadata:
  name: ingress-configmap
data:
  proxy-read-timeout: "86400s"
  client-max-body-size: "2g"
  use-http2: "false"

我的入口:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  tls:
    - hosts:
        - my.endpoint.net
      secretName: ingress-tls
  rules:
    - host: my.endpoint.net
      http:
        paths:
          - path: /
            backend:
              serviceName: web
              servicePort: 443
          - path: /api
            backend:
              serviceName: api
              servicePort: 443

如何让我的 Ingress 从 ConfigMap 加载配置?

How do I make my Ingress to load the configuration from the ConfigMap?

推荐答案

我已经设法使用以下选项显示 Helm 执行的 YAML:--dry-run --debug 选项helm install 命令结束.然后我注意到控制器是用以下命令执行的: --configmap={namespace-where-the-nginx-ingress-is-deployed}/{name-of-the-helm-chart}-nginx-入口控制器.为了加载你的 ConfigMap,你需要用你自己的(检查命名空间)覆盖它.

I've managed to display what YAML gets executed by Helm using the: --dry-run --debug options at the end of helm install command. Then I've noticed that there controller is executed with the: --configmap={namespace-where-the-nginx-ingress-is-deployed}/{name-of-the-helm-chart}-nginx-ingress-controller. In order to load your ConfigMap you need to override it with your own (check out the namespace).

kind: ConfigMap
apiVersion: v1
metadata:
  name: {name-of-the-helm-chart}-nginx-ingress-controller
  namespace: {namespace-where-the-nginx-ingress-is-deployed}
data:
  proxy-read-timeout: "86400"
  proxy-body-size: "2g"
  use-http2: "false"

配置属性列表可以在此处.

这篇关于如何在 Helm NginX Ingress 控制器中使用 ConfigMap 配置 - Kubernetes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆