Guest User

k8s/db-deployment.json

a guest
Jul 30th, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.86 KB | None | 0 0
  1. {
  2.   "apiVersion": "apps/v1",
  3.   "kind": "Deployment",
  4.   "metadata": {
  5.     "name": "sample-db"
  6.   },
  7.   "spec": {
  8.     "replicas": 1,
  9.     "selector": {
  10.       "matchLabels": {
  11.         "app": "sample-db"
  12.       }
  13.     },
  14.     "strategy": {},
  15.     "template": {
  16.       "metadata": {
  17.         "labels": {
  18.           "app": "sample-db"
  19.         }
  20.       },
  21.       "spec": {
  22.         "volumes": [
  23.           {
  24.             "name": "sample-db-storage",
  25.             "persistentVolumeClaim": {
  26.               "claimName": "sample-db-pvclaim"
  27.             }
  28.           }
  29.         ],
  30.         "containers": [
  31.           {
  32.             "image": "postgres",
  33.             "name": "sample-db",
  34.             "env": [
  35.               {
  36.                 "name": "POSTGRES_USER",
  37.                 "valueFrom": {
  38.                   "configMapKeyRef": {
  39.                     "name": "sample-db-config",
  40.                     "key": "db_user"
  41.                   }
  42.                 }
  43.               },
  44.               {
  45.                 "name": "POSTGRES_PASSWORD",
  46.                 "valueFrom": {
  47.                   "configMapKeyRef": {
  48.                     "name": "sample-db-config",
  49.                     "key": "db_password"
  50.                   }
  51.                 }
  52.               },
  53.               {
  54.                 "name": "PGDATA",
  55.                 "value": "/var/lib/postgresql/data/pgdata"
  56.               },
  57.               {
  58.                 "name": "POSTGRES_DB",
  59.                 "value": "sample"
  60.               }
  61.             ],
  62.             "ports": [
  63.               {
  64.                 "containerPort": 5432,
  65.                 "name": "sample-db"
  66.               }
  67.             ],
  68.             "volumeMounts": [
  69.               {
  70.                 "name": "sample-db-storage",
  71.                 "mountPath": "/var/lib/postgresql/data"
  72.               }
  73.             ]
  74.           }
  75.         ]
  76.       }
  77.     }
  78.   }
  79. }
  80.  
Advertisement
Add Comment
Please, Sign In to add comment