大网数据广告活动
服务器运维问答

Providing a flag to NGINX Ingress Controller that doesn't run as a Deployment

· 52CE 我爱测

In general, my question about setting up a default certificate is answered here: Kubernetes ingress How to set default-ssl-certificate? . What I don't understand is this part: I'm supposed to add the flag --default-ssl-certificat…

问题原文

原帖链接 · AbreQueVoy · CC BY-SA 4.0

In general, my question about setting up a default certificate is answered here: Kubernetes ingress How to set default-ssl-certificate?.

What I don't understand is this part: I'm supposed to add the flag --default-ssl-certificate=kube-system/host-cert as the Ingress' argument. And to discover the YAML config file settings of the NGINX Ingress Controller I should check it with command like: kubectl describe deployment/nginx-ingress-controller --namespace. But it doesn't run as a deployment:

$ kubectl get deployments --all-namespaces
NAMESPACE     NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
kube-system   kubernetes-dashboard         1/1     1            1           3d
kube-system   kubernetes-metrics-scraper   1/1     1            1           3d

It only works as a pod:

$ kubectl get pods --all-namespaces
NAMESPACE       NAME                                          READY   STATUS    RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-8xcl9                1/1     Running   1 (2d ago)     3d
ingress-nginx   ingress-nginx-controller-hwhvk                1/1     Running   1 (2d ago)     3d
ingress-nginx   ingress-nginx-controller-xqdqx                1/1     Running   3 (2d ago)     3d
kube-system     kubernetes-dashboard-548847967d-66dwz         1/1     Running   2 (2d ago)     3d
kube-system     kubernetes-metrics-scraper-6d49f96c97-r6dz2   1/1     Running   1 (2d ago)     3d
[...]

How should I supply the flag to the Controller then?

已采纳解答

原帖链接 · moonkotte · CC BY-SA 4.0

ingress-nginx can be installed as deployment or daemonset. In your case if you don't see a deployment, it's a daemonset.

You can find it by running:

kubectl get daemonset -A

And edit in the same way as deployment:

kubectl edit daemonset ingress-nginx-controller -n ingress-nginx

You can find details here about ingress-nginx and daemonset


Note! Change you're going to make won't be permanent (until any upgrade/re-applying of manifest). Depending on how it was originally deployed, there are two options:

  • from manifest

    you will need to add it to manifest so any other updates/kubectl apply -f manifest.yaml will contain this flags and everything will continue working

  • using helm

    you will need to add this information to helm_repo/templates/controller-daemonset.yaml:

    args:
      - /nginx-ingress-controller
      ...
      - --default-ssl-certificate=kube-system/host-cert
      ...
    

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-11-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。