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.

117 lines
3.8 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_class is defined %}
  54. - --ingress-class={{ ingress_nginx_class }}
  55. {% endif %}
  56. {% if ingress_nginx_host_network %}
  57. - --report-node-internal-ip-address
  58. {% endif %}
  59. {% if ingress_publish_status_address != "" %}
  60. - --publish-status-address={{ ingress_publish_status_address }}
  61. {% endif %}
  62. {% for extra_arg in ingress_nginx_extra_args %}
  63. - {{ extra_arg }}
  64. {% endfor %}
  65. securityContext:
  66. capabilities:
  67. drop:
  68. - ALL
  69. add:
  70. - NET_BIND_SERVICE
  71. # www-data -> 101
  72. runAsUser: 101
  73. allowPrivilegeEscalation: true
  74. env:
  75. - name: POD_NAME
  76. valueFrom:
  77. fieldRef:
  78. fieldPath: metadata.name
  79. - name: POD_NAMESPACE
  80. valueFrom:
  81. fieldRef:
  82. fieldPath: metadata.namespace
  83. - name: LD_PRELOAD
  84. value: /usr/local/lib/libmimalloc.so
  85. ports:
  86. - name: http
  87. containerPort: 80
  88. hostPort: {{ ingress_nginx_insecure_port }}
  89. - name: https
  90. containerPort: 443
  91. hostPort: {{ ingress_nginx_secure_port }}
  92. - name: metrics
  93. containerPort: 10254
  94. {% if not ingress_nginx_host_network %}
  95. hostPort: {{ ingress_nginx_metrics_port }}
  96. {% endif %}
  97. livenessProbe:
  98. failureThreshold: 3
  99. httpGet:
  100. path: /healthz
  101. port: 10254
  102. scheme: HTTP
  103. initialDelaySeconds: 10
  104. periodSeconds: 10
  105. timeoutSeconds: 5
  106. successThreshold: 1
  107. failureThreshold: 3
  108. readinessProbe:
  109. httpGet:
  110. path: /healthz
  111. port: 10254
  112. scheme: HTTP
  113. initialDelaySeconds: 10
  114. periodSeconds: 10
  115. timeoutSeconds: 5
  116. successThreshold: 1
  117. failureThreshold: 3