From Traefik to APISIX on single-node k0s: what broke
Published: 2026-07-15
Traefik ran on my k0s cluster for 224 days without a single complaint. It held ports 80/443 through hostNetwork, wrote JSON access logs and never crashed once. I didn't move to APISIX because "Traefik is bad". I moved because "I want a newer, lighter stack, and I'm already cleaning up monitoring and logging anyway". On paper, replacing an ingress controller sounds like a rolling update. On a single-node bare-metal cluster, it became a direct cutover with downtime and about a dozen problems. Some of them would have quietly broken production if I hadn't checked each one live.
The problem
The cluster is one physical node with k0s and no external load balancer. Traefik held 80/443 through hostNetwork: true. This is the only option that works when a LoadBalancer Service stays in <pending> forever. 19 domains (my personal site, a VPN dashboard, a Docker registry, Grafana, VictoriaMetrics, webmail) went through Traefik IngressRoute. This is Traefik's own CRD, not the standard networking.k8s.io/v1 Ingress.
The plan looked clean: install APISIX next to Traefik, run tests, switch traffic without losing a single second. The plan died on the first attempt. The Kubernetes scheduler refused to place the APISIX pod:
text0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports
Two pods with hostNetwork: true, both want 80 and 443, and there is only one node. Without a second node, blue-green is physically impossible here. So Traefik goes first, APISIX comes right after it, and I fix whatever breaks along the way, live.
How it works
apisix-ingress-controller together with the apisix/apisix chart gives you two components in one Helm release. The first is the gateway itself (the data plane on OpenResty). The second is a controller that watches Ingress objects and pushes config into APISIX through the Admin API. By default, APISIX also brings etcd. It doesn't store application data there. It uses etcd as intermediate storage for routes between the controller and the gateway.
bashhelm repo add apisix https://apache.github.io/apisix-helm-chart
helm repo update
Then the install, with the full set of flags that I really needed (I explain each one below):
bashhelm upgrade --install apisix apisix/apisix \
--namespace apisix \
-f apisix-logs-values.yaml \
--set apisix.ssl.enabled=true \
--set apisix.ssl.containerPort=443 \
--set ingress-controller.enabled=true \
--set ingress-controller.gatewayProxy.createDefault=true \
--set ingress-controller.gatewayProxy.provider.controlPlane.service.name=apisix-admin \
--set ingress-controller.gatewayProxy.provider.controlPlane.auth.adminKey.value=edd1c9f034335f136f87ad84b625c8f1 \
--set hostNetwork=true \
--set service.http.containerPort=80 \
--set service.type=ClusterIP \
--set 'securityContext.capabilities.add[0]=NET_BIND_SERVICE' \
--set securityContext.runAsUser=0 \
--set updateStrategy.type=Recreate \
--set etcd.replicaCount=1 \
--set etcd.persistence.enabled=false \
--wait --timeout 180s
Each line here cost me one failed attempt.
Step by step
Step 1: HTTPS is off by default
The first install went fine and the pods came up, but HTTPS did not answer at all. The reason: in the chart values, apisix.ssl.enabled is false by default. Without it, the gateway doesn't open a listener on 443 at all, no matter what the Service or hostNetwork settings say.
bashhelm show values apisix/apisix | grep -A3 "^ ssl:"
yamlssl:
enabled: false # there it is
containerPort: 9443
I spent about twenty minutes looking at ports and Services. Only then did I think of checking the feature flag itself, not everything around it.
Step 2: the right key for the TLS port
Since there is service.http.containerPort, you would expect service.tls.containerPort too. It doesn't exist. I checked it with helm show values instead of guessing from memory:
yamlservice:
tls:
servicePort: 443
# no containerPort here at all
The HTTPS listener port is set somewhere else: apisix.ssl.containerPort, in a separate SSL section, not in the Service section. The same idea lives in two different places in the values tree. This is a common trap in Helm charts whose structure changed faster than their docs.
Step 3: commas in --set break the JSON string
JSON access logs were part of the reason for the whole move. I set the format:
bash--set apisix.nginx.logs.accessLogFormat='{"time":"$time_iso8601","host":"$http_host","status":$status}'
The install finished with no errors. The logs inside the pod looked like this:
text["time":"2026-07-15T07:26:53+00:00" "host":"antonnovikov.com" "status":200]
Square brackets instead of curly ones, spaces instead of commas. Valid JSON turned into garbage, and Helm didn't show a single error. The reason: --set splits its value on unescaped commas and treats them as separators between different key=value pairs. A JSON format string is full of commas. Helm quietly turned one string into a YAML list of separate "key":"value" pairs, and the chart template rendered that list however it liked.
The right way is to never use --set for values with commas. Pass them in a file instead:
yaml# apisix-logs-values.yaml
apisix:
nginx:
logs:
accessLogFormat: '{"time":"$time_iso8601","remote_addr":"$remote_addr","host":"$http_host","request_uri":"$request_uri","status":$status}'
accessLogFormatEscape: json
bashhelm upgrade apisix apisix/apisix -n apisix -f apisix-logs-values.yaml --reuse-values
Step 4: the pod can't bind to port 80
text2026/07/15 07:26:53 [emerg] 1#1: bind() to 0.0.0.0:80 failed (13: Permission denied)
Ports below 1024 need either root or the CAP_NET_BIND_SERVICE capability. Traefik already had this in its chart values. I just forgot to copy the same setting for APISIX:
yamlsecurityContext:
capabilities:
add: [NET_BIND_SERVICE]
runAsNonRoot: false
runAsUser: 0
Step 5: etcd wants a PersistentVolumeClaim that doesn't exist
textFailedBinding: no persistent volumes available for this claim and no storage class is set
On bare-metal k0s without dynamic provisioning, the chart's default etcd requests a PVC and stays in Pending forever. etcd.persistence.enabled=false is fine here. The only data in etcd is the runtime route config, and it doesn't need to survive a pod restart: the controller rebuilds it from Ingress objects in seconds.
Step 6: GatewayProxy doesn't create itself
ingress-controller.enabled=true turns the controller on, but without a GatewayProxy the controller doesn't know where to push config:
textINFO provider.client syncing all resources
INFO provider.client no GatewayProxy configs provided
GatewayProxy is a separate CRD. It links an IngressClass to the Admin API of a specific gateway (address, port, auth key). The gatewayProxy.createDefault=true flag creates it automatically, but you still need to set the Admin API Service name and the key explicitly:
bash--set ingress-controller.gatewayProxy.createDefault=true \
--set ingress-controller.gatewayProxy.provider.controlPlane.service.name=apisix-admin \
--set ingress-controller.gatewayProxy.provider.controlPlane.auth.adminKey.value=edd1c9f034335f136f87ad84b625c8f1
The key edd1c9f034335f136f87ad84b625c8f1 is the default demo key of APISIX itself. Out of the box, the gateway and the controller use the same key, but it's better to set it explicitly than to hope the defaults match.
Step 7: hostNetwork + rolling update is a dead end on one node
Every next helm upgrade hung for minutes:
textWaiting for daemon set... 0 out of 1 new pods have been updated
The default update strategy is RollingUpdate: start the new pod first, then kill the old one. With hostNetwork: true and one node, this is impossible. The new pod wants the same 80/443 that the old pod still holds. It's the same problem as at the very start, but now it hits every update, not only the first install next to Traefik.
bash--set updateStrategy.type=Recreate
Recreate kills the old pod first and then creates the new one. You get a second of downtime on every update, but no endless hang.
Step 8: 404 on CSS and JS after switching routes
The site came up and the domains returned 200, but the browser console was full of this:
textRefused to apply style from '.../assets/css/styles.css' because its MIME type
('text/html') is not a supported stylesheet MIME type
The bug was in my own migration logic. In Traefik, seven subdomains (cv., weblog., status. and others) share one site pod through an addPrefix middleware: cv.antonnovikov.com/ becomes /cv/ before proxying. When I moved the routes to standard Ingress, I applied the rewrite annotation to every path, with no exceptions. That included /assets/*, which lives in a shared folder without a prefix. So the request went to /cv/assets/... instead of /assets/... and got a 404. The backend kindly returned an HTML error page instead of CSS, hence the text/html MIME type.
In Traefik, a separate route rule for /assets without a rewrite handled this. I simply missed it in the first version of the migration. The fix is two Ingress objects per domain instead of one: one without a rewrite for static files and the domain's own prefix, and one with a rewrite for everything else.
yaml# passthrough - no rewrite, for /assets and static files
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cv-subdomain-passthrough
annotations:
k8s.apisix.apache.org/http-to-https: "true"
spec:
ingressClassName: apisix
rules:
- host: cv.antonnovikov.com
http:
paths:
- path: /assets
pathType: Prefix
backend: {service: {name: antonnovikov-site, port: {number: 80}}}
- path: /cv
pathType: Prefix
backend: {service: {name: antonnovikov-site, port: {number: 80}}}
---
# catchall - with rewrite, for root and everything else
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cv-subdomain
annotations:
k8s.apisix.apache.org/http-to-https: "true"
k8s.apisix.apache.org/rewrite-target-regex: "^/(.*)"
k8s.apisix.apache.org/rewrite-target-regex-template: "/cv/$1"
spec:
ingressClassName: apisix
rules:
- host: cv.antonnovikov.com
http:
paths:
- path: /
pathType: Prefix
backend: {service: {name: antonnovikov-site, port: {number: 80}}}
The standard Ingress API handles priority by itself. A more specific path (/assets, /cv) wins over the general /, and I didn't need to configure anything else.
Step 9: two domains were redirects, not the site
In the Traefik dump, tg.antonnovikov.com and sofyanovikova.ru looked like normal routes to the site backend. When I looked at the middleware, I found that they were permanent redirects to Telegram channels, not proxying: a redirectRegex with a .* pattern pointing to a fixed URL. The first version of the migration copied them as normal domains. They would have stopped redirecting and started showing the site instead. APISIX has a ready-made annotation for this, no separate CRD needed:
yamlmetadata:
annotations:
k8s.apisix.apache.org/http-redirect: "https://t.me/example"
k8s.apisix.apache.org/http-redirect-code: "301"
Step 10: there are metrics, just not the right ones
apisix_nginx_http_current_connections appeared in /apisix/prometheus/metrics right away. apisix_http_status, apisix_http_latency and apisix_bandwidth did not, even though traffic was already flowing. Basic nginx-level metrics are always written, but per-request metrics need the prometheus plugin enabled globally:
yamlapiVersion: apisix.apache.org/v2
kind: ApisixGlobalRule
metadata:
name: prometheus-metrics
namespace: apisix
spec:
ingressClassName: apisix
plugins:
- name: prometheus
enable: true
Also, by default the exporter listens on 127.0.0.1:9091 inside the pod. You can't reach it from outside through a Kubernetes Service, only through port-forward, and port-forward hides the problem while you debug. I had to change the bind address explicitly:
yamlapisix:
pluginAttrs:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091
And create a Service that the chart doesn't create by itself:
yamlapiVersion: v1
kind: Service
metadata:
name: apisix-metrics
namespace: apisix
spec:
selector:
app.kubernetes.io/name: apisix
app.kubernetes.io/instance: apisix
ports:
- name: metrics
port: 9091
targetPort: 9091
Step 11: --reuse-values after a failed upgrade quietly rolled everything back
After one of the JSON format fixes, I ran helm upgrade --reuse-values --set updateStrategy.type=Recreate. The log format went back to the broken version from Step 3. --reuse-values takes values not from the last upgrade attempt, but from the last successfully deployed release. One of the attempts in between was marked failed: the --wait timeout expired, even though the resources had been applied. So Helm used the release before it and quietly buried my fix. Lesson: after --reuse-values, always check helm get values -n <ns> -a. Don't trust that the upgrade applied what you just fixed.
What can go wrong
A domain returns 200, but the content is wrong. Check not only the status code but also the actual <title> or a specific file. A 404 from the backend can look like a 200 if the frontend catches the error with its own SPA page.
The ingress controller logs no GatewayProxy configs provided again and again. The GatewayProxy was not created or points to the wrong Service. Check: kubectl get gatewayproxy -n apisix and kubectl logs -n apisix -l app.kubernetes.io/name=ingress-controller.
After helm upgrade, a pod is stuck in Pending. On a single node with hostNetwork: true, this is almost always a port conflict with the old pod of the same role. Check: kubectl get events -n <ns> | grep FailedScheduling. The fix is updateStrategy.type=Recreate, not a longer timeout.
A metric exists in PromQL, but it has no data. Check that the plugin is really attached (ApisixGlobalRule) and that the exporter port listens on 0.0.0.0, not on 127.0.0.1. kubectl exec into the pod with a local curl won't show this. You need to send the request through the Service.
Summary
- On a single bare-metal node with
hostNetwork, blue-green between two ingress controllers is impossible: the scheduler blocks the conflicting ports. It is a direct cutover with planned downtime, not a rolling update. - Running
helm show valuesbefore the install is not a formality. I found three real bugs (ssl.enabled, the wrong port key, a broken--setwith commas) only through it, not through the docs. - Never pass values with commas through
--set: JSON strings, lists, anything with a,inside. Use only-f values.yaml. - Moving routes is not a simple one-to-one CRD swap. Middleware that looked unimportant (
addPrefixon only some paths,redirectRegexinstead of proxying) changes behavior if you don't reproduce it exactly. hostNetwork+ one node meansupdateStrategy: Recreateforever, not only for the first install.- Ingress controller metrics and logs are separate work after the cutover. Installing the chart doesn't give them to you automatically.