[verified] feat(deploy): run v0.1.2 as non-root

This commit is contained in:
2026-09-30 20:41:56 +09:00
parent bf746e0cf3
commit ee3e3852ee
13 changed files with 333 additions and 12 deletions
+184
View File
@@ -0,0 +1,184 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: jarca-ledger
labels:
app.kubernetes.io/name: jarca-ledger
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: jarca-ledger
template:
metadata:
labels:
app.kubernetes.io/name: jarca-ledger
spec:
automountServiceAccountToken: false
enableServiceLinks: false
terminationGracePeriodSeconds: 30
imagePullSecrets:
- name: jarca-ledger-registry
nodeSelector:
kubernetes.io/os: linux
kubernetes.io/arch: arm64
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
initContainers:
- name: init-db
image: gitea.jsfamily.quest/jsfamily/jarca-ledger-mcp:v0.1.2
imagePullPolicy: IfNotPresent
command:
- python
- -c
- >-
from jarca_ledger_mcp.service import health_check;
result = health_check();
assert result["success"], result
env:
- name: JARCA_LEDGER_DB_PATH
value: /data/ledger.sqlite3
- name: HOME
value: /tmp
- name: TMPDIR
value: /tmp
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
volumeMounts:
- name: data
mountPath: /data
- name: init-tmp
mountPath: /tmp
containers:
- name: mcp
image: gitea.jsfamily.quest/jsfamily/jarca-ledger-mcp:v0.1.2
imagePullPolicy: IfNotPresent
env:
- name: JARCA_LEDGER_DB_PATH
value: /data/ledger.sqlite3
- name: HOME
value: /tmp
- name: TMPDIR
value: /tmp
ports:
- name: mcp
containerPort: 8000
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
startupProbe:
tcpSocket:
port: mcp
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 24
readinessProbe:
tcpSocket:
port: mcp
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
tcpSocket:
port: mcp
periodSeconds: 20
timeoutSeconds: 2
failureThreshold: 3
volumeMounts:
- name: data
mountPath: /data
- name: mcp-tmp
mountPath: /tmp
- name: dashboard
image: gitea.jsfamily.quest/jsfamily/jarca-ledger-mcp:v0.1.2
imagePullPolicy: IfNotPresent
command:
- python
- -m
- streamlit
- run
- dashboard/app.py
- --server.address
- 0.0.0.0
- --server.port
- "8501"
- --server.headless
- "true"
- --browser.gatherUsageStats
- "false"
env:
- name: JARCA_LEDGER_DB_PATH
value: /data/ledger.sqlite3
- name: HOME
value: /tmp
- name: TMPDIR
value: /tmp
- name: JARCA_DASHBOARD_ADMIN_ID
valueFrom:
secretKeyRef:
name: jarca-ledger-dashboard-auth
key: admin-id
- name: JARCA_DASHBOARD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: jarca-ledger-dashboard-auth
key: admin-password
ports:
- name: dashboard
containerPort: 8501
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
startupProbe:
httpGet:
path: /_stcore/health
port: dashboard
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 24
readinessProbe:
httpGet:
path: /_stcore/health
port: dashboard
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
httpGet:
path: /_stcore/health
port: dashboard
periodSeconds: 20
timeoutSeconds: 2
failureThreshold: 3
volumeMounts:
- name: data
mountPath: /data
- name: dashboard-tmp
mountPath: /tmp
volumes:
- name: data
persistentVolumeClaim:
claimName: jarca-ledger-data
- name: init-tmp
emptyDir: {}
- name: mcp-tmp
emptyDir: {}
- name: dashboard-tmp
emptyDir: {}
+9
View File
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: jarca-ledger
resources:
- namespace.yaml
- pvc.yaml
- deployment.yaml
- services.yaml
- networkpolicy.yaml
+4
View File
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: jarca-ledger
+14
View File
@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: jarca-ledger-ingress
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: jarca-ledger
policyTypes:
- Ingress
ingress:
- ports:
- protocol: TCP
port: 8501
+11
View File
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jarca-ledger-data
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 1Gi
+13
View File
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: jarca-ledger-dashboard
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: jarca-ledger
ports:
- name: http
port: 8501
targetPort: dashboard
appProtocol: http