From 79e5ace8944fea4cfcb55e1541c84e5ebbcf431d Mon Sep 17 00:00:00 2001 From: Jlopez Date: Wed, 10 Apr 2024 18:24:41 -0400 Subject: [PATCH] add configmap with conf.d for nginx deployment --- apps/applets/hello/base/kustomization.yaml | 1 + apps/applets/hello/base/nginx/configMap.yaml | 13 +++++++++++++ apps/applets/hello/base/nginx/deployment.yaml | 13 ++++++++----- apps/applets/hello/base/nginx/service.yaml | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 apps/applets/hello/base/nginx/configMap.yaml diff --git a/apps/applets/hello/base/kustomization.yaml b/apps/applets/hello/base/kustomization.yaml index fa5c0f3..3cf1c3e 100644 --- a/apps/applets/hello/base/kustomization.yaml +++ b/apps/applets/hello/base/kustomization.yaml @@ -9,3 +9,4 @@ resources: - redis/statefulset.yaml - nginx/deployment.yaml - nginx/service.yaml + - nginx/configMap.yaml diff --git a/apps/applets/hello/base/nginx/configMap.yaml b/apps/applets/hello/base/nginx/configMap.yaml new file mode 100644 index 0000000..318099b --- /dev/null +++ b/apps/applets/hello/base/nginx/configMap.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-config +data: + custom-nginx.conf: | + server { + listen 8080; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + } diff --git a/apps/applets/hello/base/nginx/deployment.yaml b/apps/applets/hello/base/nginx/deployment.yaml index e8e9ca2..157711b 100644 --- a/apps/applets/hello/base/nginx/deployment.yaml +++ b/apps/applets/hello/base/nginx/deployment.yaml @@ -18,20 +18,20 @@ spec: - name: nginx-cdn image: nginx:stable ports: - - containerPort: 80 + - containerPort: 8080 volumeMounts: - name: hello-volume mountPath: /usr/share/nginx/html - name: nginx-temp mountPath: /var/cache/nginx + - name: config-volume + mountPath: /etc/nginx/conf.d + readOnly: true securityContext: runAsUser: 1000 runAsGroup: 1000 readOnlyRootFilesystem: true - allowPrivilegeEscalation: false - capabilities: - add: - - NET_BIND_SERVICE + allowPrivilegeEscalation: false resources: requests: cpu: "100m" @@ -45,3 +45,6 @@ spec: claimName: hello-pvc - name: nginx-temp emptyDir: {} + - name: config-volume + configMap: + name: nginx-config diff --git a/apps/applets/hello/base/nginx/service.yaml b/apps/applets/hello/base/nginx/service.yaml index 505089e..51f5dc9 100644 --- a/apps/applets/hello/base/nginx/service.yaml +++ b/apps/applets/hello/base/nginx/service.yaml @@ -8,5 +8,5 @@ spec: ports: - protocol: TCP port: 80 - targetPort: 80 + targetPort: 8080 type: ClusterIP