Common files and configs for all CinePik microservices.
Useful resources:
- Create ingress controller in AKS: Managed nginx Ingress with the application routing add-on
- Deploy Prometheus in k8s: How to Setup Prometheus Monitoring On Kubernetes Cluster
- Deploy Grafana in k8s: How To Setup Grafana On Kubernetes
- Create and use a volume in AKS: Create and use a volume with Azure Disks in Azure Kubernetes Service (AKS)
# Logging
docker-compose -f docker-compose.logging.yml up -d --build
docker-compose -f docker-compose.logging.yml downCreate namespace
kubectl apply -f /monitoring/k8s/namespace.ymlCreate cluster role for Prometheus
kubectl apply -f /monitoring/k8s/prometheus-role.ymlCreate config map for Prometheus
kubectl apply -f /monitoring/k8s/prometheus-configmap.ymlCreate persistent volume claim for Prometheus
kubectl apply -f /monitoring/k8s/prometheus-pvc.ymlCreate deployment and service for Prometheus
kubectl apply -f /monitoring/k8s/prometheus-deployment.ymlCreate config map for Grafana
kubectl apply -f /monitoring/k8s/grafana-configmap.ymlCreate secret for Grafana
kubectl create secret generic grafana-secret --namespace monitoring \
--from-literal=admin-user='admin' \
--from-literal=admin-password='<REPLACE_ME>'Create persistent volume claim for Grafana
kubectl apply -f /monitoring/k8s/grafana-pvc.ymlCreate deployment and service for Grafana
kubectl apply -f /monitoring/k8s/grafana-deployment.ymlCreate default ingress controller.
kubectl apply -f k8s/ingress.ymlCreate monitoring ingress controller. Make sure to create the monitoring namespace first.
kubectl create namespace monitoringSince each app expects traffic to be on / some app redirects cannot be handled correctly by ingress, i.e. all prometheus traffic needs to be on /prometheus/something.
The best solution would be to solve this in the ingress itself, but not all solutions fix everything. Currently using the rewrite-target annotation works for Prometheus, but not for Grafana, so the current fix for Grafana is to use an environment variable GF_SERVER_ROOT_URL to set the base path.
kubectl apply -f k8s/ingress-monitoring.ymlkubectl get ingress
kubectl get pods -o wide
kubectl get service
kubectl describe ingress cinepik-ingress
kubectl delete ingress cinepik-ingress