-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: sales-system | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: database-data | ||
namespace: sales-system | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: database | ||
namespace: sales-system | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: database | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: database | ||
spec: | ||
dnsPolicy: ClusterFirstWithHostNet | ||
hostNetwork: true | ||
terminationGracePeriodSeconds: 60 | ||
volumes: | ||
- name: data | ||
persistentVolumeClaim: | ||
claimName: database-data | ||
containers: | ||
- name: postgres | ||
image: postgres:15.3 | ||
volumeMounts: | ||
- name: data | ||
mountPath: /var/lib/postgresql/data | ||
resources: | ||
requests: | ||
cpu: "500m" # I need access to 1/2 core on the node. | ||
memory: 500Mi | ||
limits: | ||
cpu: "500m" # Execute instructions 50ms/100ms on my 1/2 core. | ||
memory: 500Mi | ||
env: | ||
- name: POSTGRES_PASSWORD | ||
value: postgres | ||
ports: | ||
- name: postgres | ||
containerPort: 5432 | ||
livenessProbe: | ||
exec: | ||
command: | ||
- pg_isready | ||
- -h | ||
- localhost | ||
- -U | ||
- postgres | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
exec: | ||
command: | ||
- pg_isready | ||
- -h | ||
- localhost | ||
- -U | ||
- postgres | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 1 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: database-service | ||
namespace: sales-system | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: database | ||
ports: | ||
- name: postgres | ||
port: 5432 | ||
targetPort: postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./dev-database.yaml |