Skip to content

Commit

Permalink
Start filling out the kubernetes services.
Browse files Browse the repository at this point in the history
global info: supplied with config-map and Secrets
postgres: seems to be able to deploy and run
  • Loading branch information
bdklahn committed May 14, 2024
1 parent 382d387 commit b814dcc
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kubernetes/config-map_EXAMPLE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: global-info
data:
db_host: 127.0.0.1
postgres_name: cloud_copasi_db
postgres_user: cloud_copasi_user
django_debug: "True"
43 changes: 43 additions & 0 deletions kubernetes/database/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres-deployment
spec:
replicas: 1
selector:
matchLabels:
app: postgres-container
template:
metadata:
labels:
app: postgres-container
tier: backend
spec:
containers:
- name: postgres-container
image: postgres
env:
- name: POSTGRES_NAME
valueFrom:
configMapKeyRef:
name: global-info
key: postgres_name
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
name: global-info
key: postgres_user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: secret-info
key: postgres_password
ports:
- containerPort: 5432
volumeMounts:
- name: postgres-pv
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-pv
persistentVolumeClaim:
claimName: postgres-pvc
15 changes: 15 additions & 0 deletions kubernetes/database/pv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-pv
labels:
type: local
app: postgress
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/db"
14 changes: 14 additions & 0 deletions kubernetes/database/pvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-pvc
labels:
type: local
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeName: postgres-pv
11 changes: 11 additions & 0 deletions kubernetes/database/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: Service
apiVersion: v1
metadata:
name: postgres-cluster-ip-service
spec:
type: ClusterIP
selector:
app: postgres-container
ports:
- protocol: TCP
port: 5432
15 changes: 15 additions & 0 deletions kubernetes/secrets_EXAMPLE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Secret
metadata:
name: secret-info
type: Opaque
stringData:
django_secret_key: secret123
postgres_password: password
example_rsa.key: |
-----BEGIN RSA PRIVATE KEY-----
MIGsAgEA___My___QFg/UMsVGrAvsm1wkonC/5jX+ykJAMeNffnlPQkCAwEAAQIh
ANgcs+MgClkXFQAP___example___0SgUbN+u+rrYNRlAhEA+K0ghKRgKlzVnOxw
qltgTwIRAOfb8LCVNf6FAdD+bJGwH___key___O1sONZBQiAWAf6Am8CEQDIEXI8
fVSNHmp108UNZcNLAhEA3hHFV5jZppEHHHLy4F9Dnw==
-----END RSA PRIVATE KEY-----

0 comments on commit b814dcc

Please sign in to comment.