diff --git a/.github/workflows/kubernetes_test.yaml b/.github/workflows/kubernetes_test.yaml index 1b9b1d895..abb3f97e4 100644 --- a/.github/workflows/kubernetes_test.yaml +++ b/.github/workflows/kubernetes_test.yaml @@ -122,6 +122,9 @@ jobs: - name: Get qhub-config.yaml full path run: echo "QHUB_CONFIG_PATH=`realpath ./local-deployment/qhub-config.yaml`" >> $GITHUB_ENV + + - name: Sleep to see if it fixes flaky Kubernetes Tests + run: sleep 60 - name: Cypress run uses: cypress-io/github-action@v2 diff --git a/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/ingress/main.tf b/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/ingress/main.tf index a4e626a30..db7f22b79 100644 --- a/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/ingress/main.tf +++ b/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/ingress/main.tf @@ -107,6 +107,38 @@ resource "kubernetes_service" "main" { } } +resource "kubernetes_service" "traefik_internal" { + wait_for_load_balancer = true + + metadata { + name = "${var.name}-traefik-internal" + namespace = var.namespace + annotations = { + "prometheus.io/scrape" = "true" + "prometheus.io/path" = "/metrics" + "prometheus.io/port" = 9000 + } + labels = { + "app.kubernetes.io/component" = "traefik-internal-service" + "app.kubernetes.io/part-of" = "traefik-ingress" + } + } + + spec { + selector = { + "app.kubernetes.io/component" = "traefik-ingress" + } + + port { + name = "http" + protocol = "TCP" + port = 9000 + target_port = 9000 + } + + type = "ClusterIP" + } +} resource "kubernetes_deployment" "main" { metadata { @@ -189,6 +221,8 @@ resource "kubernetes_deployment" "main" { "--entryPoints.traefik.address=:9000", "--entrypoints.web.http.redirections.entryPoint.to=websecure", "--entrypoints.web.http.redirections.entryPoint.scheme=https", + # Enable Prometheus Monitoring of Traefik + "--metrics.prometheus=true", # Enable debug logging. Useful to work out why something might not be # working. Fetch logs of the pod. "--log.level=${var.loglevel}", diff --git a/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/monitoring/main.tf b/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/monitoring/main.tf index a6d8d3dce..24fea8223 100755 --- a/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/monitoring/main.tf +++ b/qhub/template/{{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/monitoring/main.tf @@ -5,6 +5,34 @@ resource "helm_release" "kube-prometheus-stack-helm-deployment" { chart = "kube-prometheus-stack" version = "16.12.0" + values = [<