From 0d894d164bb42b5fd016382ea79d8b0295ef7740 Mon Sep 17 00:00:00 2001 From: talksik Date: Fri, 28 Jul 2023 14:29:16 -0700 Subject: [PATCH] postgres and hello world server --- helloworld.yaml | 32 ++++++++++++++++++++++++++++++++ postgres-deployment.yaml | 36 ++++++++++++++++++++++++++++++++++++ postgres-pvc.yaml | 13 +++++++++++++ run.sh | 10 ++++++++++ 4 files changed, 91 insertions(+) create mode 100644 helloworld.yaml create mode 100644 postgres-deployment.yaml create mode 100644 postgres-pvc.yaml create mode 100755 run.sh diff --git a/helloworld.yaml b/helloworld.yaml new file mode 100644 index 0000000..be7caa5 --- /dev/null +++ b/helloworld.yaml @@ -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 + diff --git a/postgres-deployment.yaml b/postgres-deployment.yaml new file mode 100644 index 0000000..3f6c547 --- /dev/null +++ b/postgres-deployment.yaml @@ -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 diff --git a/postgres-pvc.yaml b/postgres-pvc.yaml new file mode 100644 index 0000000..fff7f28 --- /dev/null +++ b/postgres-pvc.yaml @@ -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 diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..037692c --- /dev/null +++ b/run.sh @@ -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 +