postgres and hello world server

This commit is contained in:
talksik
2023-07-28 14:29:16 -07:00
parent 87c01fbcfa
commit 0d894d164b
4 changed files with 91 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
# Save the output of this file and use kubectl create -f to import
# it into Kubernetes.
#
# Created with podman-4.3.1
apiVersion: v1
kind: Pod
metadata:
annotations:
io.kubernetes.cri-o.TTY/helloworld: "false"
io.podman.annotations.autoremove/helloworld: "FALSE"
io.podman.annotations.init/helloworld: "FALSE"
io.podman.annotations.privileged/helloworld: "FALSE"
io.podman.annotations.publish-all/helloworld: "FALSE"
labels:
app: helloworld-pod
name: helloworld-pod
spec:
automountServiceAccountToken: false
containers:
- image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0
name: helloworld
ports:
- containerPort: 8080
hostPort: 8080
securityContext:
capabilities:
drop:
- CAP_MKNOD
- CAP_NET_RAW
- CAP_AUDIT_WRITE
enableServiceLinks: false
+36
View File
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: docker.io/library/postgres:14
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432
- hostPort: 5432
env:
- name: POSTGRES_USER
value: admin
- name: POSTGRES_PASSWORD
value: water
- name: POSTGRES_DB
value: defaultdb
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pv-claim
+13
View File
@@ -0,0 +1,13 @@
# this is the persistent volume for your postgres instance
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgresql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
Executable
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
echo "if there is an error, make sure to prune the volume and then rerun this script" &&
podman volume prune &&
podman play kube postgres-pvc.yaml --replace &&
podman play kube postgres-deployment.yaml --replace &&
podman play kube helloworld.yaml --replace