CinePik / common

Common files and configs for all CinePik microservices.
MIT License
0 stars 0 forks source link

common

Common files and configs for all CinePik microservices.

Useful resources:

Docker

Docker Compose

# Logging
docker-compose -f docker-compose.logging.yml up -d --build
docker-compose -f docker-compose.logging.yml down

Kubernetes deployment

Monitoring

Create namespace

kubectl apply -f /monitoring/k8s/namespace.yml

Prometheus

Create cluster role for Prometheus

kubectl apply -f /monitoring/k8s/prometheus-role.yml

Create config map for Prometheus

kubectl apply -f /monitoring/k8s/prometheus-configmap.yml

Create persistent volume claim for Prometheus

kubectl apply -f /monitoring/k8s/prometheus-pvc.yml

Create deployment and service for Prometheus

kubectl apply -f /monitoring/k8s/prometheus-deployment.yml

Grafana

Create config map for Grafana

kubectl apply -f /monitoring/k8s/grafana-configmap.yml

Create 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.yml

Create deployment and service for Grafana

kubectl apply -f /monitoring/k8s/grafana-deployment.yml

Setup

Routing

Create default ingress controller.

kubectl apply -f k8s/ingress.yml

Create monitoring ingress controller. Make sure to create the monitoring namespace first.

kubectl create namespace monitoring

Since 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.yml

Other useful commands

kubectl get ingress
kubectl get pods -o wide
kubectl get service
kubectl describe ingress cinepik-ingress
kubectl delete ingress cinepik-ingress