From 0d594247b45f6dd09f3776550fc05e6b2b5bffb1 Mon Sep 17 00:00:00 2001 From: Magnus Andersson Date: Tue, 4 Jun 2024 13:12:40 +0200 Subject: [PATCH] Add health ingress endpoint --- k8s/health/base/health-deployment.yml | 26 +++++++++++++++ k8s/health/base/health-ingress.yml | 32 +++++++++++++++++++ k8s/health/base/health-namespace.yml | 8 +++++ k8s/health/base/health-service.yml | 25 +++++++++++++++ k8s/health/base/kustomization.yaml | 7 ++++ .../overlays/matrix-prod/health-ingress.yml | 30 +++++++++++++++++ .../overlays/matrix-prod/kustomization.yaml | 6 ++++ .../overlays/matrix-test/health-ingress.yml | 30 +++++++++++++++++ .../overlays/matrix-test/kustomization.yaml | 6 ++++ 9 files changed, 170 insertions(+) create mode 100644 k8s/health/base/health-deployment.yml create mode 100644 k8s/health/base/health-ingress.yml create mode 100644 k8s/health/base/health-namespace.yml create mode 100644 k8s/health/base/health-service.yml create mode 100644 k8s/health/base/kustomization.yaml create mode 100644 k8s/health/overlays/matrix-prod/health-ingress.yml create mode 100644 k8s/health/overlays/matrix-prod/kustomization.yaml create mode 100644 k8s/health/overlays/matrix-test/health-ingress.yml create mode 100644 k8s/health/overlays/matrix-test/kustomization.yaml diff --git a/k8s/health/base/health-deployment.yml b/k8s/health/base/health-deployment.yml new file mode 100644 index 0000000..f5076ca --- /dev/null +++ b/k8s/health/base/health-deployment.yml @@ -0,0 +1,26 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: health-node + namespace: health + creationTimestamp: + labels: + app: health-node +spec: + replicas: 3 + selector: + matchLabels: + app: health-node + template: + metadata: + creationTimestamp: + labels: + app: health-node + spec: + containers: + - name: echoserver + image: k8s.gcr.io/echoserver:1.10 + resources: {} + strategy: {} +status: {} diff --git a/k8s/health/base/health-ingress.yml b/k8s/health/base/health-ingress.yml new file mode 100644 index 0000000..7a1946b --- /dev/null +++ b/k8s/health/base/health-ingress.yml @@ -0,0 +1,32 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: health-ingress + namespace: health + annotations: + kubernetes.io/ingress.class: traefik + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" +spec: + defaultBackend: + service: + name: health-node + port: + number: 8443 + tls: + - hosts: + - kube-matrixtest.matrix.test.sunet.se + secretName: tls-secret + + rules: + - host: kube-matrixtest.matrix.test.sunet.se + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: health-node + port: + number: 8080 diff --git a/k8s/health/base/health-namespace.yml b/k8s/health/base/health-namespace.yml new file mode 100644 index 0000000..e4cecd0 --- /dev/null +++ b/k8s/health/base/health-namespace.yml @@ -0,0 +1,8 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: health +spec: + finalizers: + - kubernetes diff --git a/k8s/health/base/health-service.yml b/k8s/health/base/health-service.yml new file mode 100644 index 0000000..c8f74ce --- /dev/null +++ b/k8s/health/base/health-service.yml @@ -0,0 +1,25 @@ +--- +apiVersion: v1 +items: +- apiVersion: v1 + kind: Service + metadata: + labels: + app: health-node + name: health-node + namespace: health + spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: health-node + sessionAffinity: None + type: ClusterIP + status: + loadBalancer: {} +kind: List +metadata: + resourceVersion: "" + selfLink: "" diff --git a/k8s/health/base/kustomization.yaml b/k8s/health/base/kustomization.yaml new file mode 100644 index 0000000..67a6292 --- /dev/null +++ b/k8s/health/base/kustomization.yaml @@ -0,0 +1,7 @@ +resources: +- health-deployment.yml +- health-ingress.yml +- health-namespace.yml +- health-service.yml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization diff --git a/k8s/health/overlays/matrix-prod/health-ingress.yml b/k8s/health/overlays/matrix-prod/health-ingress.yml new file mode 100644 index 0000000..2a1bb6d --- /dev/null +++ b/k8s/health/overlays/matrix-prod/health-ingress.yml @@ -0,0 +1,30 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: health-ingress + namespace: health + annotations: + kubernetes.io/ingress.class: nginx +spec: + defaultBackend: + service: + name: health-node + port: + number: 8443 + ingressClassName: nginx +# tls: +# - hosts: +# - kube-matrix.matrix.sunet.se +# secretName: tls-secret + rules: + - host: kube-matrix.matrix.sunet.se + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: health-node + port: + number: 8080 diff --git a/k8s/health/overlays/matrix-prod/kustomization.yaml b/k8s/health/overlays/matrix-prod/kustomization.yaml new file mode 100644 index 0000000..d323ebf --- /dev/null +++ b/k8s/health/overlays/matrix-prod/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patches: +- path: health-ingress.yml diff --git a/k8s/health/overlays/matrix-test/health-ingress.yml b/k8s/health/overlays/matrix-test/health-ingress.yml new file mode 100644 index 0000000..00b4114 --- /dev/null +++ b/k8s/health/overlays/matrix-test/health-ingress.yml @@ -0,0 +1,30 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: health-ingress + namespace: health + annotations: + kubernetes.io/ingress.class: nginx +spec: + defaultBackend: + service: + name: health-node + port: + number: 8443 + ingressClassName: nginx +# tls: +# - hosts: +# - kube-matrixtest.matrix.test.sunet.se +# secretName: tls-secret + rules: + - host: kube-matrixtest.matrix.test.sunet.se + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: health-node + port: + number: 8080 diff --git a/k8s/health/overlays/matrix-test/kustomization.yaml b/k8s/health/overlays/matrix-test/kustomization.yaml new file mode 100644 index 0000000..d323ebf --- /dev/null +++ b/k8s/health/overlays/matrix-test/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patches: +- path: health-ingress.yml