All Tools View Categories About Contact Privacy

Nginx Config to Kubernetes Ingress Converter

Turn nginx server_name and location blocks into a ready-to-apply Ingress manifest.

Runs entirely in your browser - nothing is uploaded and no cloud connection is made.
Your Kubernetes Ingress YAML will appear here.
-
rules
-
paths
-
servers

About Nginx Config to Kubernetes Ingress Converter

Moving a workload from a bare nginx server block into Kubernetes usually means rewriting the entire host and path layout as an Ingress manifest by hand, a task that is tedious and error-prone when several domains and location blocks are involved. The Nginx Config to Kubernetes Ingress Converter reads a pasted server block, extracts every server_name and location, and emits a clean networking.k8s.io/v1 Ingress with one rule per host and one path per location, ready to apply with kubectl.

At the heart of the configuration are a handful of directives. server the nginx context that groups a listen port, server_name and locations; each becomes one or more Ingress host rules. server_name declares the domain(s) the block answers for; each valid domain is mapped to an Ingress rule host. location matches a request path in nginx and becomes an Ingress path with pathType Prefix. proxy_pass the upstream nginx forwards to; the converter replaces it with a Service name and port you provide. Ingress (networking.k8s.io/v1) the Kubernetes object this tool emits, with spec.rules driving host and path routing. pathType: Prefix the Ingress path matching mode that best mirrors nginx location prefix matching. Together they shape how the server behaves, and the tool assembles them in the right context so the result is valid on the first try.

Common mistakes are easy to make. A server block with no server_name cannot produce a host, so the converter falls back to a placeholder example.com and flags it for review. nginx location regex and exact matches are flattened to Prefix, which can widen matching; tighten pathType manually if you need exact behavior. Backend Service and port are not present in nginx, so you must supply them or the manifest will reference a name you have not created yet. TLS and certificate handling live on the Ingress controller, not in the server block, so they are intentionally omitted from the output. The generator anticipates each of these and either sets a safe default or rejects the input with a clear message before anything is written to your clipboard.

Validation is strict because small configuration errors fail in subtle ways. Every input is checked for plausibility, and after the block is assembled it is re-parsed by a built-in tokenizer so unbalanced braces, missing semicolons or stray characters cannot reach your clipboard. Stat cards report line and block counts, and copy, download and print exports are one click away. Everything runs in your browser; nothing you type is transmitted to any server.

In practice this block drops into any standard nginx install. Save the output as a file under /etc/nginx/conf.d/ (or sites-available with a symlink), run nginx -t to confirm the syntax, then reload with nginx -s reload. Because the generator emits a single, self-contained server block with no hidden dependencies, it composes cleanly with your existing caching, logging and security configuration without directive collisions.

Beyond producing correct config, the tool is a reference you can read back and learn from. Each control maps to a real nginx directive, the sample button shows a complete working block in seconds, and clearing the form resets every field to its safe default. Standardising on a generator like this removes per-developer variation, keeps your configuration readable, and gives you a repeatable, auditable setup that passes nginx -t on the first try.

When something looks wrong in production, the first move is always to re-run nginx -t and inspect /var/log/nginx/error.log; most failures surface there with a line number. The access log records every request, so a sudden spike or a wall of 499 responses points straight at backend or timeout problems the generator helps you avoid in the first place.

This server block is designed to sit alongside - not fight - your other configuration. Because it declares its own server_name and a single, self-contained set of directives, you can drop it into conf.d without worrying about collisions with global caching, logging or security snippets that live elsewhere in the nginx tree.

For a production site, pair this block with TLS termination: serve on 80 for the redirect or health checks, and place the encrypted listener (or a front-end load balancer / CDN) in front so clients always speak HTTPS. The generator keeps that boundary clean so the two layers compose instead of overlapping.

If a change ever needs to be undone, the output is plain text you control: delete the file from conf.d, re-run nginx -t, and reload. There is no database and no hidden state, so rolling back is as simple as restoring the previous version from version control or your own backup.

Features

  • server - the nginx context that groups a listen port, server_name and locations; each becomes one or more Ingress host rules.
  • server_name - declares the domain(s) the block answers for; each valid domain is mapped to an Ingress rule host.
  • location - matches a request path in nginx and becomes an Ingress path with pathType Prefix.
  • proxy_pass - the upstream nginx forwards to; the converter replaces it with a Service name and port you provide.
  • Ingress (networking.k8s.io/v1) - the Kubernetes object this tool emits, with spec.rules driving host and path routing.
  • pathType: Prefix - the Ingress path matching mode that best mirrors nginx location prefix matching.
  • Self-verifying output re-parsed before display.
  • Copy, Download and Print exports.
  • Load-sample button fills realistic values.
  • Statistics cards for quick checks.
  • Runs entirely in your browser - nothing uploaded.

How to Use

  1. Paste your nginx server block into the source box.
  2. Enter the Kubernetes backend Service name the traffic should reach.
  3. Enter the backend Service port (1-65535).
  4. Click Convert to Ingress (or Load sample) and review the YAML.
  5. Check that each host and path appears under spec.rules.
  6. Save the YAML and apply it with kubectl apply -f ingress.yaml.
  7. Verify routing with kubectl describe ingress and a real request.

Examples

Example 1 - Single host one server_name with a couple of locations becomes a single host rule with two Prefix paths.

Example 2 - Multiple domains two domains on one server_name yield two Ingress rules sharing the same backend.

Example 3 - Root and API paths location / and location /api map to two paths under the same host.

Example 4 - No server_name a block without a domain falls back to example.com and is flagged for review.

Example 5 - Many server blocks several pasted server blocks are merged by host into one manifest.

Benefits

  • Automatic host-per-domain rule generation.
  • Location blocks mapped to Prefix paths with no manual YAML.
  • Backends expressed as Service name and port, not raw addresses.
  • Validation of the pasted nginx before conversion.
  • Copy, Download and JSON export of the manifest.
  • Private: everything runs in your browser.

Frequently Asked Questions

Does this create a full Ingress with TLS?
No. This tool maps hosts and paths only. Add a tls section and a Secret reference afterward, or pair it with a TLS-terminating controller.
Why is pathType set to Prefix?
Prefix matches the path and everything beneath it, which mirrors how nginx location blocks behave for most proxies.
What happens to multiple server_name values?
Each domain becomes its own rule pointing at the same backend Service, so a single manifest serves several hosts.
Where does the backend address come from?
You supply the Service name and port; the converter assumes a ClusterIP Service already exists inside the cluster.
What about listen or ssl directives?
Those are nginx-termination concerns. In Kubernetes the controller owns the listener and certificates, so they are intentionally dropped.
Can I convert many server blocks at once?
Yes - every server block in the paste is merged by host, and each unique host yields one Ingress rule.
Is the output validated?
The pasted nginx is parsed by a built-in tokenizer before conversion, so malformed input is rejected with a clear message.
Is anything uploaded?
No. All parsing and conversion happen locally in your browser.