ce7cb702218693d08ea6d83464d2457c9250027c

This commit is contained in:
ms2k 2026-11-12 20:46:28 +09:00
commit 34c5f8963c
6 changed files with 145336 additions and 0 deletions

View file

@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cluster-health-api
namespace: cluster-health
labels:
app.kubernetes.io/name: cluster-health-api
app.kubernetes.io/instance: cluster-health-api
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: cluster-health-api
app.kubernetes.io/instance: cluster-health-api
template:
metadata:
labels:
app.kubernetes.io/name: cluster-health-api
app.kubernetes.io/instance: cluster-health-api
spec:
runtimeClassName: gvisor
automountServiceAccountToken: false
imagePullSecrets:
- name: quay-cluster-pull
securityContext:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
seccompProfile:
type: RuntimeDefault
containers:
- name: api
image: registry.quorate.internal/quorate/cluster-health-api@sha256:ac076a500fe75f72cb32e702e6721060b1abb5d32232ce65f480f0351ba5c44d
ports:
- name: http
containerPort: 8080
env:
- name: LISTEN
value: 0.0.0.0:8080
- name: METRICS_URL
value: http://vmselect-main.victoriametrics.svc.cluster.local:8481/select/0/prometheus
- name: PAGE_ORIGIN
value: https://quorate.dev
- name: REFRESH_SECS
value: "60"
- name: GROUPS
value: >-
[["Nodes","label_keep(last_over_time(node_health_day[1d] offset -10m), \"node\")"],["Public services","label_keep(last_over_time(public_health_day[1d] offset -10m), \"name\")"]]
resources:
requests:
cpu: 10m
memory: 32Mi
limits:
memory: 128Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
readinessProbe:
httpGet:
path: /health
port: http

View file

@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- vso.yaml
- network-policy.yaml

View file

@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: cluster-health
labels:
gateway.quorate.internal/allow-public: "true"
security.quorate.internal/public-runtime: gvisor

View file

@ -0,0 +1,90 @@
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: api
namespace: cluster-health
spec:
endpointSelector:
matchLabels:
app.kubernetes.io/name: cluster-health-api
ingress:
- fromEntities: [host]
toPorts:
- ports:
- port: "8080"
protocol: TCP
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: cloudflare-tunnel
app.kubernetes.io/name: cloudflared
app.kubernetes.io/instance: cloudflare-tunnel
toPorts:
- ports:
- port: "8080"
protocol: TCP
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: kube-system
k8s-app: kube-dns
toPorts:
- ports:
- port: "53"
protocol: UDP
- port: "53"
protocol: TCP
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: victoriametrics
app.kubernetes.io/name: vmselect
app.kubernetes.io/instance: main
toPorts:
- ports:
- port: "8481"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: cluster-health
namespace: victoriametrics
spec:
endpointSelector:
matchLabels:
app.kubernetes.io/name: vmselect
app.kubernetes.io/instance: main
ingress:
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: cluster-health
app.kubernetes.io/name: cluster-health-api
toPorts:
- ports:
- port: "8481"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: host-health
spec:
nodeSelector: {}
ingress:
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: cluster-health
app.kubernetes.io/name: cluster-health-api
toPorts:
- ports:
- port: "32768"
endPort: 60999
protocol: TCP
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: cluster-health
app.kubernetes.io/name: cluster-health-api
toPorts:
- ports:
- port: "8080"
protocol: TCP

View file

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: cluster-health-api
namespace: cluster-health
labels:
app.kubernetes.io/name: cluster-health-api
app.kubernetes.io/instance: cluster-health-api
health.quorate.dev/name: Health
spec:
selector:
app.kubernetes.io/name: cluster-health-api
app.kubernetes.io/instance: cluster-health-api
ports:
- name: http
port: 8080
targetPort: http

View file

@ -0,0 +1,43 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: cluster-health-vso
namespace: cluster-health
automountServiceAccountToken: false
---
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultAuth
metadata:
name: default
namespace: cluster-health
spec:
method: kubernetes
mount: kubernetes
kubernetes:
role: cluster-health
serviceAccount: cluster-health-vso
vaultConnectionRef: vault/vault
---
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: quay-cluster-pull
namespace: cluster-health
spec:
type: kv-v2
mount: secret
path: quay/robots/cluster_pull
refreshAfter: 1h
destination:
name: quay-cluster-pull
create: true
overwrite: true
type: kubernetes.io/dockerconfigjson
transformation:
excludeRaw: true
excludes: [.*]
templates:
.dockerconfigjson:
text: >-
{"auths":{"registry.quorate.internal":{"auth":"{{ printf "%s:%s" (get .Secrets "username") (get .Secrets "token") | b64enc }}"}}}
vaultAuthRef: default