운영 backend·frontend는 imagePullPolicy: Never로 노드에 직접 넣은 이미지를
쓴다. 2026-11-09 디스크 사고 때 kubelet 이미지 GC가 그 이미지를 지웠고,
다시 받을 곳이 없어 hyeonworks.com이 내려갔다. redis는 움직이는 태그
redis:7-alpine이다. 세 파드 모두 우선순위가 0이고 securityContext가
비어 있다(k3s 성숙도 점검 2026-11-11, 7.2·7.5절).
- backend·frontend 이미지를 git.learn.hyeonworks.com/donghyeon.kang/
tech-log-{backend:46b1cc7,frontend:7a4e201}로, pull을 IfNotPresent로
바꾼다. 태그는 지금 운영과 같다.
- redis를 지금 운영이 쓰는 이미지의 digest로 고정한다.
- 세 파드에 priorityClassName platform-critical과 seccomp
RuntimeDefault를 둔다.
- backend는 uid 1000, redis는 uid 999로 runAsNonRoot이고 권한을 모두
버리며 allowPrivilegeEscalation: false다.
- frontend는 allowPrivilegeEscalation: false만 둔다. nginx 공식 이미지는
root로 80번을 열고 worker를 내리므로, non-root와 drop ALL은 이미지를
비특권 nginx로 바꾼 뒤에 한다(README에 남은 일로 적음).
버린 대안: frontend에도 drop ALL을 두는 것. nginx가 80번을 열고 사용자를
바꾸는 데 필요한 권한까지 빠져 뜨지 못한다.
위험·한계: 두 이미지가 레지스트리에 올라가기 전에 적용하면 파드가
ErrImagePull로 멈춘다. README가 적용 전 확인을 요구한다. backend는
Recreate라 1분 안팎 멈추고, redis 재시작으로 로그인 세션이 풀린다.
아직 적용하지 않았다.
검증: kubectl diff는 위 칸들만 바뀐다고 보여 준다. kubectl apply
--dry-run=server는 통과하고, frontend에 PSA restricted 경고(non-root,
drop ALL)만 낸다. desktop Docker에서 같은 조건으로 띄워 봤다. redis는
uid 999·cap-drop ALL·no-new-privileges로 PONG을 돌려준다. backend는
uid 1000으로 Tomcat과 DB 연결 시도까지 권한 오류 없이 뜬다. frontend는
no-new-privileges와 기본 seccomp에서 /config.json 200이다. 이 repo의
pnpm 게이트는 돌리지 않았다(YAML과 README만 바뀜).
69 lines
1.7 KiB
YAML
69 lines
1.7 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: techlog-frontend
|
|
spec:
|
|
progressDeadlineSeconds: 600
|
|
replicas: 1
|
|
revisionHistoryLimit: 10
|
|
selector:
|
|
matchLabels:
|
|
app: techlog-frontend
|
|
strategy:
|
|
rollingUpdate:
|
|
maxSurge: 25%
|
|
maxUnavailable: 25%
|
|
type: RollingUpdate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: techlog-frontend
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
containers:
|
|
- image: git.learn.hyeonworks.com/donghyeon.kang/tech-log-frontend:7a4e201
|
|
imagePullPolicy: IfNotPresent
|
|
livenessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /config.json
|
|
port: 80
|
|
scheme: HTTP
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 20
|
|
successThreshold: 1
|
|
timeoutSeconds: 1
|
|
name: frontend
|
|
ports:
|
|
- containerPort: 80
|
|
name: http
|
|
protocol: TCP
|
|
readinessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /config.json
|
|
port: 80
|
|
scheme: HTTP
|
|
initialDelaySeconds: 3
|
|
periodSeconds: 5
|
|
successThreshold: 1
|
|
timeoutSeconds: 1
|
|
resources:
|
|
limits:
|
|
memory: 128Mi
|
|
requests:
|
|
cpu: 20m
|
|
memory: 32Mi
|
|
terminationMessagePath: /dev/termination-log
|
|
terminationMessagePolicy: File
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
dnsPolicy: ClusterFirst
|
|
restartPolicy: Always
|
|
schedulerName: default-scheduler
|
|
securityContext:
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
terminationGracePeriodSeconds: 30
|
|
priorityClassName: platform-critical
|