diff --git a/app/_healthz/route.ts b/app/_healthz/route.ts new file mode 100644 index 0000000..59f4c8c --- /dev/null +++ b/app/_healthz/route.ts @@ -0,0 +1,14 @@ +import { NextRequest, NextResponse } from "next/server"; + +export const GET = async (req: NextRequest) => { + if (req.headers.get("user-agent") !== "healthz") { + return NextResponse.json({ error: "Not found" }, { status: 404 }); + } + + return new Response("OK", { + status: 200, + headers: { + "Content-Type": "text/plain", + }, + }); +}; \ No newline at end of file diff --git a/manifest/deployment.yaml b/manifest/deployment.yaml index 205764c..59961ba 100644 --- a/manifest/deployment.yaml +++ b/manifest/deployment.yaml @@ -47,9 +47,7 @@ spec: path: /_healthz port: 3000 httpHeaders: - - name: x-real-ip - value: "100.100.100.100" - name: user-agent - value: "Kubernetes healthchecks" + value: "healthz" initialDelaySeconds: 3 periodSeconds: 3 \ No newline at end of file diff --git a/public/_healthz b/public/_healthz deleted file mode 100644 index a0aba93..0000000 --- a/public/_healthz +++ /dev/null @@ -1 +0,0 @@ -OK \ No newline at end of file