Use Liveness and Readiness Probes
Kubernetes provides liveness and readiness probes that can be used to monitor the health of
individual microservices.
▪ Liveness probes check to see if a microservice is still running, and readiness probes check to
see if a microservice is ready to receive traffic.
▪ Use Monitoring Tools
Monitoring tools can be used to monitor the health and performance of microservices that can
be integrated with Kubernetes to provide alerts or notifications when issues arise. I.e.
Prometheus, Grafana, Datadog.
▪ Use Log Analysis Tools
Analyze log messages generated by your microservices and identify issues or trends. Elastic
Stack (Elasticsearch, Logstash, Kibana), Fluentd, Splunk.
▪ Set up Alerts and Notifications
Setting up alerts and notifications can help to ensure that relevant parties are notified when
issues arise, allowing them to be addressed quickly. Slack, Teams, Email, SMS.
xxxxxxxxxx
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
spec:
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
supplementalGroups:
- 0
containers:
- name: grafana
image: grafana/grafana:7.5.2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-pv
volumes:
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
ports:
- port: 3000
protocol: TCP
targetPort: http-grafana
selector:
app: grafana
sessionAffinity: None
type: LoadBalancer