masterone: k8s manifests for Rancher migration (app+postgres, NodePort 30095)
This commit is contained in:
parent
18800c7046
commit
bfc8dd7809
3 changed files with 188 additions and 0 deletions
4
clusters/default/masterone/00-namespace.yaml
Normal file
4
clusters/default/masterone/00-namespace.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: masterone
|
||||||
84
clusters/default/masterone/10-postgres.yaml
Normal file
84
clusters/default/masterone/10-postgres.yaml
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
# PostgreSQL for the MasterOne portal (hostPath PV — single-node local cluster;
|
||||||
|
# data persists on the host under /root/rancher/data/masterone/postgres).
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: masterone-postgres-pv
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 10Gi
|
||||||
|
accessModes: [ReadWriteOnce]
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/rancher/masterone/postgres
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: masterone-postgres
|
||||||
|
namespace: masterone
|
||||||
|
spec:
|
||||||
|
accessModes: [ReadWriteOnce]
|
||||||
|
volumeName: masterone-postgres-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: postgres
|
||||||
|
namespace: masterone
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: postgres
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: postgres
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: postgres
|
||||||
|
image: postgres:17-alpine
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: masterone_portal
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: masterone
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: masterone-secrets
|
||||||
|
key: POSTGRES_PASSWORD
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
subPath: pgdata
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command: ["pg_isready", "-U", "masterone", "-d", "masterone_portal"]
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: masterone-postgres
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: postgres
|
||||||
|
namespace: masterone
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: postgres
|
||||||
|
ports:
|
||||||
|
- port: 5432
|
||||||
|
targetPort: 5432
|
||||||
100
clusters/default/masterone/20-portal.yaml
Normal file
100
clusters/default/masterone/20-portal.yaml
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
# MasterOne portal app. Image is built and imported locally (masterone-portal:k8s);
|
||||||
|
# uploads persist on hostPath PV. Secrets (API keys, DB creds, PORTAL_SECRET_KEY)
|
||||||
|
# live in the masterone-secrets Secret — created imperatively, NEVER committed to git.
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: masterone-uploads-pv
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 10Gi
|
||||||
|
accessModes: [ReadWriteOnce]
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/rancher/masterone/uploads
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: masterone-uploads
|
||||||
|
namespace: masterone
|
||||||
|
spec:
|
||||||
|
accessModes: [ReadWriteOnce]
|
||||||
|
volumeName: masterone-uploads-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: portal
|
||||||
|
namespace: masterone
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: portal
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: portal
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: portal
|
||||||
|
image: masterone-portal:k8s
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- containerPort: 8095
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: masterone-secrets
|
||||||
|
env:
|
||||||
|
- name: PORTAL_MASTERONE_ROOT
|
||||||
|
value: /masterone
|
||||||
|
- name: DATABASE_URL
|
||||||
|
value: postgresql://masterone:$(POSTGRES_PASSWORD)@postgres.masterone.svc.cluster.local/masterone_portal
|
||||||
|
- name: PORTAL_COOKIE_SECURE
|
||||||
|
value: "1"
|
||||||
|
volumeMounts:
|
||||||
|
- name: uploads
|
||||||
|
mountPath: /app/uploads
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8095
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
periodSeconds: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: 8095
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 30
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 100m
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
volumes:
|
||||||
|
- name: uploads
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: masterone-uploads
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: portal
|
||||||
|
namespace: masterone
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
selector:
|
||||||
|
app: portal
|
||||||
|
ports:
|
||||||
|
- port: 8095
|
||||||
|
targetPort: 8095
|
||||||
|
nodePort: 30095
|
||||||
Loading…
Add table
Add a link
Reference in a new issue