2018-02-13 09:08:44 +08:00
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
|
|
|
name: ingress-nginx-controller
|
|
|
|
namespace: {{ ingress_nginx_namespace }}
|
|
|
|
labels:
|
2018-09-02 12:19:38 +08:00
|
|
|
app.kubernetes.io/name: ingress-nginx
|
|
|
|
app.kubernetes.io/part-of: ingress-nginx
|
2018-02-13 09:08:44 +08:00
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2018-09-02 12:19:38 +08:00
|
|
|
app.kubernetes.io/name: ingress-nginx
|
|
|
|
app.kubernetes.io/part-of: ingress-nginx
|
2018-02-13 09:08:44 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2018-09-02 12:19:38 +08:00
|
|
|
app.kubernetes.io/name: ingress-nginx
|
|
|
|
app.kubernetes.io/part-of: ingress-nginx
|
2018-03-20 13:47:36 +08:00
|
|
|
annotations:
|
2018-10-23 20:08:04 +08:00
|
|
|
prometheus.io/port: "10254"
|
|
|
|
prometheus.io/scrape: "true"
|
2018-02-13 09:08:44 +08:00
|
|
|
spec:
|
2018-06-07 17:25:25 +08:00
|
|
|
serviceAccountName: ingress-nginx
|
2021-12-02 19:23:33 +08:00
|
|
|
terminationGracePeriodSeconds: {{ ingress_nginx_termination_grace_period_seconds }}
|
2024-04-30 18:46:17 +08:00
|
|
|
{% if ingress_nginx_opentelemetry_enabled %}
|
|
|
|
initContainers:
|
|
|
|
- name: opentelemetry
|
|
|
|
command:
|
|
|
|
- /init_module
|
|
|
|
image: {{ ingress_nginx_opentelemetry_image_repo }}:{{ ingress_nginx_opentelemetry_image_tag }}
|
|
|
|
securityContext:
|
|
|
|
runAsNonRoot: true
|
|
|
|
runAsUser: 65532
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
seccompProfile:
|
|
|
|
type: RuntimeDefault
|
|
|
|
capabilities:
|
|
|
|
drop:
|
|
|
|
- ALL
|
|
|
|
readOnlyRootFilesystem: true
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /modules_mount
|
|
|
|
name: modules
|
|
|
|
{% endif %}
|
2018-03-19 17:59:38 +08:00
|
|
|
{% if ingress_nginx_host_network %}
|
2018-03-17 07:54:46 +08:00
|
|
|
hostNetwork: true
|
2019-06-05 18:17:56 +08:00
|
|
|
dnsPolicy: ClusterFirstWithHostNet
|
2018-03-17 07:54:46 +08:00
|
|
|
{% endif %}
|
2018-06-07 17:25:25 +08:00
|
|
|
{% if ingress_nginx_nodeselector %}
|
2018-03-17 07:54:46 +08:00
|
|
|
nodeSelector:
|
2020-09-30 22:23:26 +08:00
|
|
|
{{ ingress_nginx_nodeselector | to_nice_yaml | indent(width=8) }}
|
2018-06-07 17:25:25 +08:00
|
|
|
{%- endif %}
|
2018-11-27 19:30:16 +08:00
|
|
|
{% if ingress_nginx_tolerations %}
|
|
|
|
tolerations:
|
|
|
|
{{ ingress_nginx_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
|
2019-02-05 04:59:01 +08:00
|
|
|
{% endif %}
|
2023-07-05 11:36:54 +08:00
|
|
|
priorityClassName: {% if ingress_nginx_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{ '' }}
|
2018-02-13 09:08:44 +08:00
|
|
|
containers:
|
|
|
|
- name: ingress-nginx-controller
|
|
|
|
image: {{ ingress_nginx_controller_image_repo }}:{{ ingress_nginx_controller_image_tag }}
|
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2020-04-22 23:41:52 +08:00
|
|
|
lifecycle:
|
|
|
|
preStop:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- /wait-shutdown
|
2018-02-13 09:08:44 +08:00
|
|
|
args:
|
|
|
|
- /nginx-ingress-controller
|
|
|
|
- --configmap=$(POD_NAMESPACE)/ingress-nginx
|
2024-02-12 18:58:45 +08:00
|
|
|
- --election-id=ingress-controller-leader-{{ ingress_nginx_class }}
|
2018-06-07 17:25:25 +08:00
|
|
|
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
|
|
|
|
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
|
2018-02-13 09:08:44 +08:00
|
|
|
- --annotations-prefix=nginx.ingress.kubernetes.io
|
2021-04-22 15:22:38 +08:00
|
|
|
- --ingress-class={{ ingress_nginx_class }}
|
2023-05-24 19:12:50 +08:00
|
|
|
{% if ingress_nginx_without_class %}
|
2021-10-29 02:48:59 +08:00
|
|
|
- --watch-ingress-without-class=true
|
2021-04-22 15:22:38 +08:00
|
|
|
{% endif %}
|
2019-04-29 16:44:22 +08:00
|
|
|
{% if ingress_nginx_host_network %}
|
|
|
|
- --report-node-internal-ip-address
|
2019-08-07 10:24:50 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if ingress_publish_status_address != "" %}
|
|
|
|
- --publish-status-address={{ ingress_publish_status_address }}
|
2019-04-29 16:44:22 +08:00
|
|
|
{% endif %}
|
2019-11-11 19:51:41 +08:00
|
|
|
{% for extra_arg in ingress_nginx_extra_args %}
|
|
|
|
- {{ extra_arg }}
|
|
|
|
{% endfor %}
|
2022-06-29 02:55:35 +08:00
|
|
|
{% if ingress_nginx_webhook_enabled %}
|
|
|
|
- --validating-webhook=:8443
|
|
|
|
- --validating-webhook-certificate=/usr/local/certificates/cert
|
|
|
|
- --validating-webhook-key=/usr/local/certificates/key
|
|
|
|
{% endif %}
|
2018-06-07 17:25:25 +08:00
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
drop:
|
|
|
|
- ALL
|
|
|
|
add:
|
|
|
|
- NET_BIND_SERVICE
|
2020-02-07 18:07:44 +08:00
|
|
|
# www-data -> 101
|
|
|
|
runAsUser: 101
|
2020-06-09 17:45:18 +08:00
|
|
|
allowPrivilegeEscalation: true
|
2018-02-13 09:08:44 +08:00
|
|
|
env:
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: POD_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
2020-10-06 20:10:21 +08:00
|
|
|
- name: LD_PRELOAD
|
|
|
|
value: /usr/local/lib/libmimalloc.so
|
2018-02-13 09:08:44 +08:00
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
containerPort: 80
|
|
|
|
hostPort: {{ ingress_nginx_insecure_port }}
|
|
|
|
- name: https
|
|
|
|
containerPort: 443
|
|
|
|
hostPort: {{ ingress_nginx_secure_port }}
|
2020-09-04 19:54:11 +08:00
|
|
|
- name: metrics
|
|
|
|
containerPort: 10254
|
|
|
|
{% if not ingress_nginx_host_network %}
|
|
|
|
hostPort: {{ ingress_nginx_metrics_port }}
|
2022-06-29 02:55:35 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if ingress_nginx_webhook_enabled %}
|
|
|
|
- name: webhook
|
|
|
|
containerPort: 8443
|
|
|
|
protocol: TCP
|
2020-09-04 19:54:11 +08:00
|
|
|
{% endif %}
|
2018-02-13 09:08:44 +08:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
|
|
|
port: 10254
|
|
|
|
scheme: HTTP
|
2022-10-20 12:20:56 +08:00
|
|
|
initialDelaySeconds: {{ ingress_nginx_probe_initial_delay_seconds }}
|
2020-04-22 23:41:52 +08:00
|
|
|
periodSeconds: 10
|
2019-04-24 05:46:02 +08:00
|
|
|
timeoutSeconds: 5
|
2018-02-13 09:08:44 +08:00
|
|
|
successThreshold: 1
|
|
|
|
failureThreshold: 3
|
2020-04-22 23:41:52 +08:00
|
|
|
readinessProbe:
|
2018-02-13 09:08:44 +08:00
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
|
|
|
port: 10254
|
|
|
|
scheme: HTTP
|
2022-10-20 12:20:56 +08:00
|
|
|
initialDelaySeconds: {{ ingress_nginx_probe_initial_delay_seconds }}
|
2020-04-22 23:41:52 +08:00
|
|
|
periodSeconds: 10
|
2019-04-24 05:46:02 +08:00
|
|
|
timeoutSeconds: 5
|
2018-02-13 09:08:44 +08:00
|
|
|
successThreshold: 1
|
2020-04-22 23:41:52 +08:00
|
|
|
failureThreshold: 3
|
2024-04-30 18:46:17 +08:00
|
|
|
{% if ingress_nginx_webhook_enabled or ingress_nginx_opentelemetry_enabled %}
|
2022-06-29 02:55:35 +08:00
|
|
|
volumeMounts:
|
2024-04-30 18:46:17 +08:00
|
|
|
{% if ingress_nginx_webhook_enabled %}
|
2022-06-29 02:55:35 +08:00
|
|
|
- mountPath: /usr/local/certificates/
|
|
|
|
name: webhook-cert
|
|
|
|
readOnly: true
|
|
|
|
{% endif %}
|
2024-04-30 18:46:17 +08:00
|
|
|
{% if ingress_nginx_opentelemetry_enabled %}
|
|
|
|
- name: modules
|
|
|
|
mountPath: /modules_mount
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% if ingress_nginx_webhook_enabled or ingress_nginx_opentelemetry_enabled %}
|
2022-06-29 02:55:35 +08:00
|
|
|
volumes:
|
2024-04-30 18:46:17 +08:00
|
|
|
{% if ingress_nginx_webhook_enabled %}
|
2022-06-29 02:55:35 +08:00
|
|
|
- name: webhook-cert
|
|
|
|
secret:
|
|
|
|
secretName: ingress-nginx-admission
|
|
|
|
{% endif %}
|
2024-04-30 18:46:17 +08:00
|
|
|
{% if ingress_nginx_opentelemetry_enabled %}
|
|
|
|
- name: modules
|
|
|
|
emptyDir: {}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|