forked from oldboyxx/jira_clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s.yaml
138 lines (138 loc) · 3.24 KB
/
k8s.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
apiVersion: v1
kind: Service
metadata:
name: jira-clone
spec:
selector:
app: jira-clone
ports:
- port: 7777
targetPort: 8080
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jira-clone
spec:
replicas: 1
selector:
matchLabels:
app: jira-clone
template:
metadata:
labels:
app: jira-clone
spec:
containers:
- name: jira-clone
image: testomaticai/testomatic:jira-clone
command: ["npm"]
args: ["run", "start"]
ports:
- containerPort: 8080
env:
- name: NODE_ENV
value: "development"
- name: DB_HOST
value: "http://postgres"
- name: DB_PORT
value: "5432"
- name: DB_USERNAME
value: "jirauser"
- name: DB_PASSWORD
value: "jirapassword"
- name: DB_DATABASE
value: "jira_development"
- name: JWT_SECRET
value: "development12345"
imagePullPolicy: Always
imagePullSecrets:
- name: regcred
---
# Create ConfigMap postgres-secret for the postgres app
# Define default database name, user, and password
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-secret
labels:
app: postgres
data:
POSTGRES_DB: jira_development
POSTGRES_USER: jirauser
POSTGRES_PASSWORD: jirapassword
---
apiVersion: v1
kind: PersistentVolume # Create PV
metadata:
name: postgres-volume # Sets PV name
labels:
type: local # Sets PV's type
app: postgres
spec:
storageClassName: manual
capacity:
storage: 1Gi # Sets PV's size
accessModes:
- ReadWriteMany
hostPath:
path: "/data/postgresql" # Sets PV's host path
---
apiVersion: v1
kind: PersistentVolumeClaim # Create PVC
metadata:
name: postgres-volume-claim # Sets PVC's name
labels:
app: postgres # Defines app to create PVC for
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi # Sets PVC's size
---
apiVersion: apps/v1
kind: Deployment # Create a deployment
metadata:
name: postgres # Set the name of the deployment
spec:
replicas: 1 # Set 1 deployment replica
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:12.10 # Docker image
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432 # Exposing the container port 5432 for PostgreSQL client connections.
envFrom:
- configMapRef:
name: postgres-secret # Using the ConfigMap postgres-secret
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgresdata
volumes:
- name: postgresdata
persistentVolumeClaim:
claimName: postgres-volume-claim
---
apiVersion: v1
kind: Service # Create service
metadata:
name: postgres # Sets the service name
labels:
app: postgres # Defines app to create service for
spec:
type: NodePort # Sets the service type
ports:
- port: 5432 # Sets the port to run the postgres application
selector:
app: postgres