Comments (2)
Postgress deployment
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: workshop
name: postgresql
spec:
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
labels:
app: postgresql
spec:
containers:
- name: postgresql
image: postgres:latest
ports:
- containerPort: 5432
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
cpu: "500m"
env:
- name: POSTGRES_DB
value: mydatabase
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-sec
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-sec
key: password
postgressService.yaml
apiVersion: v1
kind: Service
metadata:
namespace: workshop
name: postgresql-svc
spec:
selector:
app: postgresql
ports:
- name: postgresql-svc
protocol: TCP
port: 5432
targetPort: 5432
secret.yaml
apiVersion: v1
kind: Secret
metadata:
namespace: workshop
name: postgres-sec
type: Opaque
data:
password: cGFzc3dvcmQxMjM= # password123 base64 encoded
username: YWRtaW4= # admin base64 encoded
Now also change the backendDeployment.yaml so that you can connect to postgress
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: workshop
labels:
role: api
env: demo
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 25%
selector:
matchLabels:
role: api
template:
metadata:
labels:
role: api
spec:
containers:
- name: api
image: public.ecr.aws/w8u5e4v2/workshop-backend:v1
imagePullPolicy: Always
env:
- name: DATABASE_URL
value: postgres://<username>:<password>@postgresql-svc:5432/mydatabase
- name: DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: postgres-sec
key: username
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-sec
key: password
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /ok
port: 8080
initialDelaySeconds: 2
periodSeconds: 5
readinessProbe:
httpGet:
path: /ok
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
from twsthreetierappchallenge.
from twsthreetierappchallenge.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twsthreetierappchallenge.