<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
# Actuator Config
management:
endpoint:
# this is useful for k8s
health:
probes:
enabled: true
# this is turing loggers on/off dynamically
loggers:
enabled: true
# this is useful for k8s
health:
livenessstate:
enabled: true
readinessstate:
enabled: true
# expose health for k8s is needed
# loggers mostly only till the dev env
endpoints:
web:
exposure:
include: loggers,health
apiVersion: apps/v1
kind: Deployment
metadata:
namespace:
name:
labels:
app:
spec:
replicas: 1
selector:
matchLabels:
app: CONTAINER_NAME
template:
metadata:
namespace:
labels:
app: CONTAINER_NAME
spec:
containers:
- name: CONTAINER_NAME
image: IMAGE NAME
imagePullPolicy: Always
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: PROPERTY_NAME
value: VALUE
# Important
# check for initial readiness, restarts if status not 200
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 20
periodSeconds: 10
# check for initial readiness, restarts if status not 200
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 20
periodSeconds: 10
resources:
requests:
memory:
cpu:
limits:
memory:
cpu:
ports:
- containerPort:
magic