Add secure portfolio foundation

This commit is contained in:
2026-07-16 05:16:02 +00:00
parent 155c31b8a2
commit be79a1e9f3
14 changed files with 1034 additions and 0 deletions
+123
View File
@@ -0,0 +1,123 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: portfolio
namespace: portfolio
labels:
app.kubernetes.io/name: portfolio
app.kubernetes.io/instance: portfolio
app.kubernetes.io/component: web
app.kubernetes.io/part-of: portfolio-platform
spec:
replicas: 2
revisionHistoryLimit: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app.kubernetes.io/name: portfolio
app.kubernetes.io/instance: portfolio
template:
metadata:
labels:
app.kubernetes.io/name: portfolio
app.kubernetes.io/instance: portfolio
app.kubernetes.io/component: web
app.kubernetes.io/part-of: portfolio-platform
spec:
serviceAccountName: portfolio
automountServiceAccountToken: false
enableServiceLinks: false
terminationGracePeriodSeconds: 20
securityContext:
runAsNonRoot: true
runAsUser: 101
runAsGroup: 101
fsGroup: 101
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app.kubernetes.io/name: portfolio
app.kubernetes.io/instance: portfolio
containers:
- name: portfolio
image: nginxinc/nginx-unprivileged:1.29.4-alpine
imagePullPolicy: IfNotPresent
command:
- nginx
args:
- -g
- daemon off;
ports:
- name: http
containerPort: 8080
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
resources:
requests:
cpu: 25m
memory: 32Mi
ephemeral-storage: 16Mi
limits:
cpu: 250m
memory: 128Mi
ephemeral-storage: 128Mi
startupProbe:
httpGet:
path: /healthz
port: http
failureThreshold: 30
periodSeconds: 2
timeoutSeconds: 2
readinessProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 2
failureThreshold: 3
volumeMounts:
- name: site
mountPath: /usr/share/nginx/html
readOnly: true
- name: nginx-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: site
configMap:
name: portfolio-site
defaultMode: 0444
- name: nginx-config
configMap:
name: portfolio-nginx
defaultMode: 0444
- name: tmp
emptyDir:
medium: Memory
sizeLimit: 32Mi