You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.7 KiB

  1. ---
  2. apiVersion: apps/v1
  3. kind: DaemonSet
  4. metadata:
  5. name: ingress-nginx-controller
  6. namespace: {{ ingress_nginx_namespace }}
  7. labels:
  8. app.kubernetes.io/name: ingress-nginx
  9. app.kubernetes.io/part-of: ingress-nginx
  10. spec:
  11. selector:
  12. matchLabels:
  13. app.kubernetes.io/name: ingress-nginx
  14. app.kubernetes.io/part-of: ingress-nginx
  15. template:
  16. metadata:
  17. labels:
  18. app.kubernetes.io/name: ingress-nginx
  19. app.kubernetes.io/part-of: ingress-nginx
  20. annotations:
  21. prometheus.io/port: "10254"
  22. prometheus.io/scrape: "true"
  23. spec:
  24. serviceAccountName: ingress-nginx
  25. {% if ingress_nginx_host_network %}
  26. hostNetwork: true
  27. dnsPolicy: ClusterFirstWithHostNet
  28. {% endif %}
  29. {% if ingress_nginx_nodeselector %}
  30. nodeSelector:
  31. {{ ingress_nginx_nodeselector | to_nice_yaml | indent(width=8) }}
  32. {%- endif %}
  33. {% if ingress_nginx_tolerations %}
  34. tolerations:
  35. {{ ingress_nginx_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
  36. {% endif %}
  37. priorityClassName: {% if ingress_nginx_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
  38. containers:
  39. - name: ingress-nginx-controller
  40. image: {{ ingress_nginx_controller_image_repo }}:{{ ingress_nginx_controller_image_tag }}
  41. imagePullPolicy: {{ k8s_image_pull_policy }}
  42. lifecycle:
  43. preStop:
  44. exec:
  45. command:
  46. - /wait-shutdown
  47. args:
  48. - /nginx-ingress-controller
  49. - --configmap=$(POD_NAMESPACE)/ingress-nginx
  50. - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
  51. - --udp-services-configmap=$(POD_NAMESPACE)/udp-services
  52. - --annotations-prefix=nginx.ingress.kubernetes.io
  53. {% if ingress_nginx_host_network %}
  54. - --report-node-internal-ip-address
  55. {% endif %}
  56. {% if ingress_publish_status_address != "" %}
  57. - --publish-status-address={{ ingress_publish_status_address }}
  58. {% endif %}
  59. {% for extra_arg in ingress_nginx_extra_args %}
  60. - {{ extra_arg }}
  61. {% endfor %}
  62. securityContext:
  63. capabilities:
  64. drop:
  65. - ALL
  66. add:
  67. - NET_BIND_SERVICE
  68. # www-data -> 101
  69. runAsUser: 101
  70. allowPrivilegeEscalation: true
  71. env:
  72. - name: POD_NAME
  73. valueFrom:
  74. fieldRef:
  75. fieldPath: metadata.name
  76. - name: POD_NAMESPACE
  77. valueFrom:
  78. fieldRef:
  79. fieldPath: metadata.namespace
  80. - name: LD_PRELOAD
  81. value: /usr/local/lib/libmimalloc.so
  82. ports:
  83. - name: http
  84. containerPort: 80
  85. hostPort: {{ ingress_nginx_insecure_port }}
  86. - name: https
  87. containerPort: 443
  88. hostPort: {{ ingress_nginx_secure_port }}
  89. - name: metrics
  90. containerPort: 10254
  91. {% if not ingress_nginx_host_network %}
  92. hostPort: {{ ingress_nginx_metrics_port }}
  93. {% endif %}
  94. livenessProbe:
  95. failureThreshold: 3
  96. httpGet:
  97. path: /healthz
  98. port: 10254
  99. scheme: HTTP
  100. initialDelaySeconds: 10
  101. periodSeconds: 10
  102. timeoutSeconds: 5
  103. successThreshold: 1
  104. failureThreshold: 3
  105. readinessProbe:
  106. httpGet:
  107. path: /healthz
  108. port: 10254
  109. scheme: HTTP
  110. initialDelaySeconds: 10
  111. periodSeconds: 10
  112. timeoutSeconds: 5
  113. successThreshold: 1
  114. failureThreshold: 3