feat(deploy): 운영 매니페스트를 repo에 두고 이미지를 레지스트리에서 받는다 #1
@@ -0,0 +1,55 @@
|
|||||||
|
# hyeonworks.com 운영 매니페스트
|
||||||
|
|
||||||
|
`hyeonworks-prod` namespace의 앱 쪽 객체 정본이다(소유자 결정 2026-11-11: 앱 쪽은 tech-log repo
|
||||||
|
`deploy/`). 플랫폼 쪽(Namespace, techlog DB Role·Database, 다른 namespace의 NetworkPolicy·Probe·
|
||||||
|
경보·대시보드)은 platform-core `services/tenants/techlog`가 맡는다. `hyeonworks-secrets` Secret은
|
||||||
|
Git 밖에서 만든다.
|
||||||
|
|
||||||
|
| 파일 | 객체 |
|
||||||
|
| --- | --- |
|
||||||
|
| `backend-*.yaml` | `techlog-backend` Deployment, Service `techlog-backend`·`techlog-management`, ServiceMonitor, ConfigMap `techlog-logging` |
|
||||||
|
| `redis-*.yaml` | 세션 저장소 `redis` Deployment·Service(저장 안 함, 재시작하면 로그인이 풀린다) |
|
||||||
|
| `frontend-*.yaml` | `techlog-frontend` Deployment·Service |
|
||||||
|
| `ingress.yaml` | `hyeonworks.com` 경로: `/api`·`/oauth2`·`/login`·`/logout` → backend, 나머지 → frontend |
|
||||||
|
| `network-policies.yaml` | namespace 안 기본 거부와 허용 여섯 |
|
||||||
|
|
||||||
|
## 이미지와 실행 사용자
|
||||||
|
|
||||||
|
| 컨테이너 | 이미지 | pull | 사용자 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| backend | `git.learn.hyeonworks.com/donghyeon.kang/tech-log-backend:46b1cc7` | `IfNotPresent` | uid 1000(이미지의 `app`), 권한 전부 버림 |
|
||||||
|
| frontend | `git.learn.hyeonworks.com/donghyeon.kang/tech-log-frontend:7a4e201` | `IfNotPresent` | root(nginx). `allowPrivilegeEscalation: false`만 |
|
||||||
|
| redis | `redis@sha256:c5d34a98…`(지금 운영이 쓰는 `redis:7-alpine`의 digest) | `IfNotPresent` | uid 999(이미지의 `redis`), 권한 전부 버림 |
|
||||||
|
|
||||||
|
- 예전에는 `imagePullPolicy: Never`로 노드에 직접 넣은 이미지를 썼다. 2026-11-09 디스크 사고 때
|
||||||
|
kubelet 이미지 GC가 그 이미지를 지웠고, 다시 받을 곳이 없어 운영이 내려갔다. 이제 Gitea 컨테이너
|
||||||
|
레지스트리에서 다시 받는다.
|
||||||
|
- 세 파드 모두 `priorityClassName: platform-critical`(platform-core `services/priority-classes`)이고
|
||||||
|
seccomp는 `RuntimeDefault`다.
|
||||||
|
- **frontend non-root는 남은 일이다.** nginx 공식 이미지는 root로 시작해 80번을 열고 worker를
|
||||||
|
`nginx`로 내린다. 권한을 버리거나 non-root로 돌리려면 이미지를 비특권 nginx(8080)로 바꾸고 Service
|
||||||
|
`targetPort`와 probe를 같이 바꿔야 한다.
|
||||||
|
|
||||||
|
## 적용
|
||||||
|
|
||||||
|
전제(하나라도 없으면 적용하지 않는다):
|
||||||
|
|
||||||
|
1. 두 이미지가 Gitea 레지스트리에 있다. 익명 pull이 되는지 노드에서 확인한다.
|
||||||
|
`sudo k3s crictl pull git.learn.hyeonworks.com/donghyeon.kang/tech-log-backend:46b1cc7`
|
||||||
|
(frontend도 같다). 미리 받아 두면 backend(Recreate)가 멈추는 시간이 짧아진다.
|
||||||
|
2. PriorityClass `platform-critical`이 있다: `kubectl get priorityclass platform-critical`.
|
||||||
|
3. Secret `hyeonworks-prod/hyeonworks-secrets`가 있다.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s -o /dev/null -w '%{http_code}\n' https://hyeonworks.com/
|
||||||
|
kubectl diff -k deploy/production
|
||||||
|
kubectl apply -k deploy/production
|
||||||
|
kubectl -n hyeonworks-prod rollout status deploy/techlog-backend deploy/techlog-frontend deploy/redis
|
||||||
|
curl -s -o /dev/null -w '%{http_code}\n' https://hyeonworks.com/
|
||||||
|
curl -s -o /dev/null -w '%{http_code}\n' https://hyeonworks.com/api/v1/public/home
|
||||||
|
```
|
||||||
|
|
||||||
|
- backend는 `Recreate`라 새 파드가 준비될 때까지 API가 멈춘다(1분 안팎).
|
||||||
|
- redis가 다시 시작되면 로그인 세션이 모두 풀린다.
|
||||||
|
|
||||||
|
되돌리기: `kubectl -n hyeonworks-prod rollout undo deploy/<이름>`. 그 뒤 이 폴더를 되돌리는 커밋을 만든다.
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: techlog-backend
|
||||||
|
spec:
|
||||||
|
progressDeadlineSeconds: 600
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: techlog-backend
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: techlog-backend
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: SPRING_PROFILES_ACTIVE
|
||||||
|
value: local
|
||||||
|
- name: SPRING_DATASOURCE_URL
|
||||||
|
value: jdbc:postgresql://platform-postgres-rw.platform-data.svc.cluster.local:5432/techlog
|
||||||
|
- name: SPRING_DATASOURCE_USERNAME
|
||||||
|
value: techlog
|
||||||
|
- name: SPRING_DATASOURCE_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: APP_DB_PASSWORD
|
||||||
|
name: hyeonworks-secrets
|
||||||
|
- name: SPRING_DATASOURCE_DRIVER_CLASS_NAME
|
||||||
|
value: org.postgresql.Driver
|
||||||
|
- name: SPRING_FLYWAY_ENABLED
|
||||||
|
value: 'true'
|
||||||
|
- name: SPRING_JPA_HIBERNATE_DDL_AUTO
|
||||||
|
value: none
|
||||||
|
- name: CA_SKELETON_PERSISTENCE_VENDOR
|
||||||
|
value: postgresql
|
||||||
|
- name: CA_SKELETON_SECURITY_AUTH_MODE
|
||||||
|
value: redis-session
|
||||||
|
- name: CA_SKELETON_SECURITY_SESSION_COOKIE_NAME
|
||||||
|
value: TECHLOG_SESSION
|
||||||
|
- name: CA_SKELETON_SECURITY_SESSION_PATH
|
||||||
|
value: /
|
||||||
|
- name: CA_SKELETON_SECURITY_SESSION_SECURE
|
||||||
|
value: 'true'
|
||||||
|
- name: CA_SKELETON_SECURITY_SESSION_SAME_SITE
|
||||||
|
value: Lax
|
||||||
|
- name: APP_REDIS_ENABLED
|
||||||
|
value: 'true'
|
||||||
|
- name: APP_REDIS_AUTHENTICATION_ANONYMOUS_ACCESS_ACCEPTED
|
||||||
|
value: 'true'
|
||||||
|
- name: SPRING_DATA_REDIS_HOST
|
||||||
|
value: redis
|
||||||
|
- name: SPRING_DATA_REDIS_PORT
|
||||||
|
value: '6379'
|
||||||
|
- name: SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KEYCLOAK_ISSUER_URI
|
||||||
|
value: https://id.learn.hyeonworks.com/realms/prod
|
||||||
|
- name: SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_CLIENT_ID
|
||||||
|
value: tech-log-bff
|
||||||
|
- name: SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_CLIENT_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: TECHLOG_OIDC_CLIENT_SECRET
|
||||||
|
name: hyeonworks-secrets
|
||||||
|
- name: SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_SCOPE
|
||||||
|
value: openid,profile,email
|
||||||
|
- name: SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_AUTHORIZATION_GRANT_TYPE
|
||||||
|
value: authorization_code
|
||||||
|
- name: SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_REDIRECT_URI
|
||||||
|
value: https://hyeonworks.com/login/oauth2/code/keycloak
|
||||||
|
- name: APP_STUDIO_AUTHOR_ROLE
|
||||||
|
value: site-admin
|
||||||
|
- name: APP_SESSION_TIMEOUT
|
||||||
|
value: 24h
|
||||||
|
- name: APP_STUDIO_POST_LOGIN_REDIRECT
|
||||||
|
value: https://hyeonworks.com/studio
|
||||||
|
- name: APP_SERVER_FORWARD_HEADERS_STRATEGY
|
||||||
|
value: framework
|
||||||
|
- name: CA_SKELETON_CORS_ALLOWED_ORIGINS
|
||||||
|
value: https://hyeonworks.com
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_BACKEND
|
||||||
|
value: s3
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_ENDPOINT
|
||||||
|
value: http://minio.object-storage.svc.cluster.local
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_REGION
|
||||||
|
value: us-east-1
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_PATH_STYLE_ACCESS
|
||||||
|
value: 'true'
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_AUTO_CREATE_BUCKET
|
||||||
|
value: 'false'
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_BUCKET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: S3_BUCKET
|
||||||
|
name: hyeonworks-secrets
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_ACCESS_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: S3_ACCESS_KEY
|
||||||
|
name: hyeonworks-secrets
|
||||||
|
- name: CA_SKELETON_OBJECTSTORAGE_SECRET_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: S3_SECRET_KEY
|
||||||
|
name: hyeonworks-secrets
|
||||||
|
- name: TZ
|
||||||
|
value: UTC
|
||||||
|
- name: MANAGEMENT_ENDPOINT_HEALTH_SHOW_COMPONENTS
|
||||||
|
value: always
|
||||||
|
- name: LOGGING_CONFIG
|
||||||
|
value: /etc/techlog-logging/logback-spring.xml
|
||||||
|
- name: APP_TRACING_SAMPLE_RATE
|
||||||
|
value: '0.1'
|
||||||
|
- name: APP_LOG_LEVEL_APP
|
||||||
|
value: INFO
|
||||||
|
- name: APP_LOG_LEVEL_ROOT
|
||||||
|
value: INFO
|
||||||
|
- name: APP_REDIS_NODES
|
||||||
|
value: redis.hyeonworks-prod.svc.cluster.local:6379
|
||||||
|
- name: APP_TRACING_ENABLED
|
||||||
|
value: 'true'
|
||||||
|
image: git.learn.hyeonworks.com/donghyeon.kang/tech-log-backend:46b1cc7
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
livenessProbe:
|
||||||
|
failureThreshold: 3
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health/liveness
|
||||||
|
port: management
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 3
|
||||||
|
name: backend
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
|
- containerPort: 9001
|
||||||
|
name: management
|
||||||
|
protocol: TCP
|
||||||
|
readinessProbe:
|
||||||
|
failureThreshold: 6
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health/readiness
|
||||||
|
port: management
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 3
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 1536Mi
|
||||||
|
requests:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 512Mi
|
||||||
|
startupProbe:
|
||||||
|
failureThreshold: 36
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health/startup
|
||||||
|
port: management
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 3
|
||||||
|
terminationMessagePath: /dev/termination-log
|
||||||
|
terminationMessagePolicy: File
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/techlog-logging
|
||||||
|
name: logging-config
|
||||||
|
readOnly: true
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
restartPolicy: Always
|
||||||
|
schedulerName: default-scheduler
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 1000
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
|
volumes:
|
||||||
|
- configMap:
|
||||||
|
name: techlog-logging
|
||||||
|
name: logging-config
|
||||||
|
priorityClassName: platform-critical
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
data:
|
||||||
|
logback-spring.xml: "<configuration>\n <include resource=\"org/springframework/boot/logging/logback/defaults.xml\"\
|
||||||
|
\ />\n\n \n <springProperty scope=\"context\" name=\"APP_NAME\" source=\"APP_NAME\" defaultValue=\"\
|
||||||
|
tech-log-backend\" />\n <springProperty scope=\"context\" name=\"APP_PROFILE\" source=\"SPRING_PROFILES_ACTIVE\"\
|
||||||
|
\ defaultValue=\"local\" />\n\n <springProperty scope=\"context\" name=\"FILE_ENABLED\" source=\"\
|
||||||
|
APP_LOG_FILE_ENABLED\" defaultValue=\"false\" />\n <springProperty scope=\"context\" name=\"FILE_PATH\"\
|
||||||
|
\ source=\"APP_LOG_FILE_PATH\" defaultValue=\"logs/tech-log-backend.json\" />\n <springProperty\
|
||||||
|
\ scope=\"context\" name=\"FILE_MAX_SIZE\" source=\"APP_LOG_FILE_MAX_SIZE\" defaultValue=\"100MB\"\
|
||||||
|
\ />\n <springProperty scope=\"context\" name=\"FILE_MAX_HISTORY\" source=\"APP_LOG_FILE_MAX_HISTORY\"\
|
||||||
|
\ defaultValue=\"14\" />\n <springProperty scope=\"context\" name=\"FILE_TOTAL_SIZE_CAP\" source=\"\
|
||||||
|
APP_LOG_FILE_TOTAL_SIZE_CAP\" defaultValue=\"3GB\" />\n\n <springProperty scope=\"context\" name=\"\
|
||||||
|
ASYNC_ENABLED\" source=\"APP_LOG_ASYNC_ENABLED\" defaultValue=\"true\" />\n <springProperty scope=\"\
|
||||||
|
context\" name=\"ASYNC_QUEUE_SIZE\" source=\"APP_LOG_ASYNC_QUEUE_SIZE\" defaultValue=\"512\" />\n\
|
||||||
|
\ <springProperty scope=\"context\" name=\"ASYNC_DISCARDING_THRESHOLD\" source=\"APP_LOG_ASYNC_DISCARDING_THRESHOLD\"\
|
||||||
|
\ defaultValue=\"20\" />\n\n <springProperty scope=\"context\" name=\"JSON_TIMEZONE\" source=\"\
|
||||||
|
APP_LOG_JSON_TIMEZONE\" defaultValue=\"UTC\" />\n <springProperty scope=\"context\" name=\"JSON_TIMESTAMP_PATTERN\"\
|
||||||
|
\ source=\"APP_LOG_JSON_TIMESTAMP_PATTERN\" defaultValue=\"yyyy-MM-dd'T'HH:mm:ss.SSSXXX\" />\n \
|
||||||
|
\ <springProperty scope=\"context\" name=\"JSON_INCLUDE_CALLER_DATA\" source=\"APP_LOG_JSON_INCLUDE_CALLER_DATA\"\
|
||||||
|
\ defaultValue=\"false\" />\n <springProperty scope=\"context\" name=\"JSON_LOGGER_NAME_LENGTH\"\
|
||||||
|
\ source=\"APP_LOG_JSON_LOGGER_NAME_LENGTH\" defaultValue=\"0\" />\n\n \n <springProperty scope=\"\
|
||||||
|
context\" name=\"LOG_SAMPLING_RATE\" source=\"APP_LOG_SAMPLING_RATE\" defaultValue=\"1.0\" />\n\n\
|
||||||
|
\ \n <conversionRule conversionWord=\"maskedMsg\" class=\"dev.caskeleton.bootstrap.logging.SecretMaskingMessageConverter\"\
|
||||||
|
\ />\n\n \n <turboFilter class=\"dev.caskeleton.bootstrap.logging.SamplingTurboFilter\">\n \
|
||||||
|
\ <rate>${LOG_SAMPLING_RATE}</rate>\n </turboFilter>\n <turboFilter class=\"dev.caskeleton.bootstrap.logging.StartupFailureSpringBootLogFilter\"\
|
||||||
|
\ />\n\n \n\n \n <appender name=\"CONSOLE\" class=\"ch.qos.logback.core.ConsoleAppender\"\
|
||||||
|
>\n <encoder class=\"net.logstash.logback.encoder.LogstashEncoder\">\n <includeContext>false</includeContext>\n\
|
||||||
|
\ <customFields>{\"app\":\"${APP_NAME}\",\"profile\":\"${APP_PROFILE}\"}</customFields>\n\
|
||||||
|
\ <includeMdcKeyName>trace_id</includeMdcKeyName>\n <includeMdcKeyName>span_id</includeMdcKeyName>\n\
|
||||||
|
\ <includeMdcKeyName>request_id</includeMdcKeyName>\n <includeMdcKeyName>correlation_id</includeMdcKeyName>\n\
|
||||||
|
\ <includeMdcKeyName>user_principal</includeMdcKeyName>\n <timeZone>${JSON_TIMEZONE}</timeZone>\n\
|
||||||
|
\ <timestampPattern>${JSON_TIMESTAMP_PATTERN}</timestampPattern>\n <includeCallerData>${JSON_INCLUDE_CALLER_DATA}</includeCallerData>\n\
|
||||||
|
\ <shortenedLoggerNameLength>${JSON_LOGGER_NAME_LENGTH}</shortenedLoggerNameLength>\n\
|
||||||
|
\ <jsonGeneratorDecorator class=\"dev.caskeleton.bootstrap.logging.SecretMaskingJsonGeneratorDecorator\"\
|
||||||
|
\ />\n </encoder>\n </appender>\n <condition class=\"ch.qos.logback.core.boolex.PropertyEqualityCondition\"\
|
||||||
|
>\n <key>FILE_ENABLED</key><value>true</value>\n </condition>\n <if>\n <then>\n\
|
||||||
|
\ <appender name=\"JSON_FILE\" class=\"ch.qos.logback.core.rolling.RollingFileAppender\"\
|
||||||
|
>\n <file>${FILE_PATH}</file>\n <rollingPolicy class=\"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy\"\
|
||||||
|
>\n <fileNamePattern>${FILE_PATH}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>\n \
|
||||||
|
\ <maxFileSize>${FILE_MAX_SIZE}</maxFileSize>\n <maxHistory>${FILE_MAX_HISTORY}</maxHistory>\n\
|
||||||
|
\ <totalSizeCap>${FILE_TOTAL_SIZE_CAP}</totalSizeCap>\n </rollingPolicy>\n\
|
||||||
|
\ <encoder class=\"net.logstash.logback.encoder.LogstashEncoder\">\n \
|
||||||
|
\ <includeContext>false</includeContext>\n <customFields>{\"app\":\"${APP_NAME}\"\
|
||||||
|
,\"profile\":\"${APP_PROFILE}\"}</customFields>\n <includeMdcKeyName>trace_id</includeMdcKeyName>\n\
|
||||||
|
\ <includeMdcKeyName>span_id</includeMdcKeyName>\n <includeMdcKeyName>request_id</includeMdcKeyName>\n\
|
||||||
|
\ <includeMdcKeyName>correlation_id</includeMdcKeyName>\n <includeMdcKeyName>user_principal</includeMdcKeyName>\n\
|
||||||
|
\ <timeZone>${JSON_TIMEZONE}</timeZone>\n <timestampPattern>${JSON_TIMESTAMP_PATTERN}</timestampPattern>\n\
|
||||||
|
\ <includeCallerData>${JSON_INCLUDE_CALLER_DATA}</includeCallerData>\n \
|
||||||
|
\ <shortenedLoggerNameLength>${JSON_LOGGER_NAME_LENGTH}</shortenedLoggerNameLength>\n \
|
||||||
|
\ <jsonGeneratorDecorator class=\"dev.caskeleton.bootstrap.logging.SecretMaskingJsonGeneratorDecorator\"\
|
||||||
|
\ />\n </encoder>\n </appender>\n </then>\n </if>\n\n \n\n\
|
||||||
|
\ <condition class=\"ch.qos.logback.core.boolex.PropertyEqualityCondition\">\n <key>ASYNC_ENABLED</key><value>true</value>\n\
|
||||||
|
\ </condition>\n <if>\n <then>\n <appender name=\"ASYNC_CONSOLE\" class=\"\
|
||||||
|
dev.caskeleton.bootstrap.logging.MetricsAsyncAppender\">\n <queueSize>${ASYNC_QUEUE_SIZE}</queueSize>\n\
|
||||||
|
\ <discardingThreshold>${ASYNC_DISCARDING_THRESHOLD}</discardingThreshold>\n \
|
||||||
|
\ <neverBlock>false</neverBlock>\n <appender-ref ref=\"CONSOLE\" />\n \
|
||||||
|
\ </appender>\n <condition class=\"ch.qos.logback.core.boolex.PropertyEqualityCondition\"\
|
||||||
|
>\n <key>FILE_ENABLED</key><value>true</value>\n </condition>\n \
|
||||||
|
\ <if>\n <then>\n <appender name=\"ASYNC_FILE\" class=\"dev.caskeleton.bootstrap.logging.MetricsAsyncAppender\"\
|
||||||
|
>\n <queueSize>${ASYNC_QUEUE_SIZE}</queueSize>\n <discardingThreshold>${ASYNC_DISCARDING_THRESHOLD}</discardingThreshold>\n\
|
||||||
|
\ <neverBlock>false</neverBlock>\n <appender-ref ref=\"\
|
||||||
|
JSON_FILE\" />\n </appender>\n </then>\n </if>\n \
|
||||||
|
\ </then>\n </if>\n\n \n\n \n <condition class=\"ch.qos.logback.core.boolex.PropertyEqualityCondition\"\
|
||||||
|
>\n <key>ASYNC_ENABLED</key><value>true</value>\n </condition>\n <if>\n <then>\n\
|
||||||
|
\ <condition class=\"ch.qos.logback.core.boolex.PropertyEqualityCondition\">\n \
|
||||||
|
\ <key>FILE_ENABLED</key><value>true</value>\n </condition>\n <if>\n\
|
||||||
|
\ <then>\n <root level=\"INFO\">\n <appender-ref\
|
||||||
|
\ ref=\"ASYNC_CONSOLE\" />\n <appender-ref ref=\"ASYNC_FILE\" />\n \
|
||||||
|
\ </root>\n </then>\n <else>\n <root level=\"\
|
||||||
|
INFO\">\n <appender-ref ref=\"ASYNC_CONSOLE\" />\n </root>\n\
|
||||||
|
\ </else>\n </if>\n </then>\n <else>\n <condition\
|
||||||
|
\ class=\"ch.qos.logback.core.boolex.PropertyEqualityCondition\">\n <key>FILE_ENABLED</key><value>true</value>\n\
|
||||||
|
\ </condition>\n <if>\n <then>\n <root level=\"\
|
||||||
|
INFO\">\n <appender-ref ref=\"CONSOLE\" />\n <appender-ref\
|
||||||
|
\ ref=\"JSON_FILE\" />\n </root>\n </then>\n <else>\n\
|
||||||
|
\ <root level=\"INFO\">\n <appender-ref ref=\"CONSOLE\"\
|
||||||
|
\ />\n </root>\n </else>\n </if>\n </else>\n \
|
||||||
|
\ </if>\n</configuration>"
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: techlog-logging
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
observability.hyeonworks.com/instance: home
|
||||||
|
name: techlog-backend
|
||||||
|
spec:
|
||||||
|
endpoints:
|
||||||
|
- interval: 30s
|
||||||
|
path: /actuator/prometheus
|
||||||
|
port: management
|
||||||
|
relabelings:
|
||||||
|
- replacement: techlog
|
||||||
|
targetLabel: application
|
||||||
|
scrapeTimeout: 10s
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: techlog-backend
|
||||||
|
component: management
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: techlog-backend
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 8080
|
||||||
|
selector:
|
||||||
|
app: techlog-backend
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: techlog-backend
|
||||||
|
component: management
|
||||||
|
name: techlog-management
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: management
|
||||||
|
port: 9001
|
||||||
|
targetPort: management
|
||||||
|
selector:
|
||||||
|
app: techlog-backend
|
||||||
|
type: ClusterIP
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
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
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: techlog-frontend
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 80
|
||||||
|
selector:
|
||||||
|
app: techlog-frontend
|
||||||
|
type: ClusterIP
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: web
|
||||||
|
name: hyeonworks-core
|
||||||
|
spec:
|
||||||
|
ingressClassName: traefik
|
||||||
|
rules:
|
||||||
|
- host: hyeonworks.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: techlog-backend
|
||||||
|
port:
|
||||||
|
number: 8080
|
||||||
|
path: /api
|
||||||
|
pathType: Prefix
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: techlog-backend
|
||||||
|
port:
|
||||||
|
number: 8080
|
||||||
|
path: /oauth2
|
||||||
|
pathType: Prefix
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: techlog-backend
|
||||||
|
port:
|
||||||
|
number: 8080
|
||||||
|
path: /login
|
||||||
|
pathType: Prefix
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: techlog-backend
|
||||||
|
port:
|
||||||
|
number: 8080
|
||||||
|
path: /logout
|
||||||
|
pathType: Prefix
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: techlog-frontend
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
path: /
|
||||||
|
pathType: Prefix
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
|
||||||
|
# Application side of hyeonworks.com in the hyeonworks-prod namespace.
|
||||||
|
# The Namespace, the techlog database role and database, and the
|
||||||
|
# NetworkPolicies, Probes and rules in platform namespaces belong to
|
||||||
|
# platform-core services/tenants/techlog. The hyeonworks-secrets Secret is
|
||||||
|
# created outside Git.
|
||||||
|
namespace: hyeonworks-prod
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- backend-logging-configmap.yaml
|
||||||
|
- backend-deployment.yaml
|
||||||
|
- backend-services.yaml
|
||||||
|
- backend-servicemonitor.yaml
|
||||||
|
- redis-deployment.yaml
|
||||||
|
- redis-service.yaml
|
||||||
|
- frontend-deployment.yaml
|
||||||
|
- frontend-service.yaml
|
||||||
|
- ingress.yaml
|
||||||
|
- network-policies.yaml
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: techlog-backend-egress
|
||||||
|
spec:
|
||||||
|
egress:
|
||||||
|
- ports:
|
||||||
|
- port: 5432
|
||||||
|
protocol: TCP
|
||||||
|
to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: platform-data
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
cnpg.io/cluster: platform-postgres
|
||||||
|
- ports:
|
||||||
|
- port: 9000
|
||||||
|
protocol: TCP
|
||||||
|
to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: object-storage
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
aistor.min.io/objectStore: minio-aistor
|
||||||
|
- ports:
|
||||||
|
- port: 6379
|
||||||
|
protocol: TCP
|
||||||
|
to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: hyeonworks-prod
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: redis
|
||||||
|
- ports:
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 192.168.0.107/32
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: techlog-backend
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: techlog-backend-ingress
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: traefik
|
||||||
|
ports:
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: observability
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: prometheus
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: observability
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: prometheus-blackbox-exporter
|
||||||
|
ports:
|
||||||
|
- port: 9001
|
||||||
|
protocol: TCP
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: techlog-backend
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: techlog-default-deny
|
||||||
|
spec:
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: techlog-dns-egress
|
||||||
|
spec:
|
||||||
|
egress:
|
||||||
|
- ports:
|
||||||
|
- port: 53
|
||||||
|
protocol: UDP
|
||||||
|
- port: 53
|
||||||
|
protocol: TCP
|
||||||
|
to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Egress
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: techlog-frontend-ingress
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: traefik
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
protocol: TCP
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: techlog-frontend
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: techlog-redis-ingress
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: hyeonworks-prod
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: techlog-backend
|
||||||
|
ports:
|
||||||
|
- port: 6379
|
||||||
|
protocol: TCP
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: redis
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
spec:
|
||||||
|
progressDeadlineSeconds: 600
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: redis
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: redis
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
containers:
|
||||||
|
- args:
|
||||||
|
- redis-server
|
||||||
|
- --save
|
||||||
|
- ''
|
||||||
|
- --appendonly
|
||||||
|
- 'no'
|
||||||
|
image: docker.io/library/redis@sha256:c5d34a98396a4775e223c74e929162c35c5a2182901ba26b50ade939941ce14b
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
failureThreshold: 3
|
||||||
|
initialDelaySeconds: 20
|
||||||
|
periodSeconds: 15
|
||||||
|
successThreshold: 1
|
||||||
|
timeoutSeconds: 1
|
||||||
|
name: redis
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
||||||
|
name: redis
|
||||||
|
protocol: TCP
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- redis-cli
|
||||||
|
- ping
|
||||||
|
failureThreshold: 3
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
timeoutSeconds: 1
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256Mi
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
terminationMessagePath: /dev/termination-log
|
||||||
|
terminationMessagePolicy: File
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
restartPolicy: Always
|
||||||
|
schedulerName: default-scheduler
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 999
|
||||||
|
runAsGroup: 999
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
|
priorityClassName: platform-critical
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
port: 6379
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 6379
|
||||||
|
selector:
|
||||||
|
app: redis
|
||||||
|
type: ClusterIP
|
||||||
Reference in New Issue
Block a user