Skip to content

Instantly share code, notes, and snippets.

@m3pratik
Created February 1, 2023 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m3pratik/95bbfb154cc72ea338bb2b601ac58195 to your computer and use it in GitHub Desktop.
Save m3pratik/95bbfb154cc72ea338bb2b601ac58195 to your computer and use it in GitHub Desktop.
readiness-probe-application-deployment yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: rails-crud-microservice
labels:
app: rails-crud
spec:
replicas: 1
selector:
matchLabels:
app: rails-crud
template:
metadata:
labels:
app: rails-crud
spec:
initContainers:
- name: init-db
image: busybox:1.31
command: ['sh', '-c', 'echo -e "Checking for the availability DB"; while ! nc -z postgres 5432; do sleep 1; printf "-"; done; echo -e " >> Postgres DB Server has started";']
containers:
- name: rails-crud
image: 123345454.dkr.ecr.us-east-1.amazonaws.com/crud:v2 # replace this image with your uploaded Image
ports:
- containerPort: 3000
env:
- name: POSTGRES_USER # this value will be get from secret we created.
valueFrom:
secretKeyRef:
name: postgres-db-envs
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-db-envs
key: POSTGRES_PASSWORD
readinessProbe:
httpGet:
path: /login
port: 3000
initialDelaySeconds: 60
periodSeconds: 10
livenessProbe:
exec:
command:
- /bin/sh
- -c
- curl localhost:3000
initialDelaySeconds: 60
periodSeconds: 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment