How-to guide / Platform capabilities
Expose a service with Ingress
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
Use kix.expose when a package already creates a Service and the cluster uses
ingress-nginx. Kix connects the generated Ingress to the Service and applies
it after the Service and ingress controller resources.
This guide assumes you have a local package whose returned parts include a
Service named service.
Make the package exposable
Section titled “Make the package exposable”Add the standard ingress options to the package:
21 options.ingress = kix.options.ingress;The cluster author will use config.ingress.host to choose the hostname. The
option set also accepts annotations for controller-specific configuration.
Add kix.expose to the package’s build list and name the Service part it
should route to:
56 (kix.expose { service = "service"; })kix.expose reads the Service name and port from that part, so the package
doesn’t need to repeat either value.
Add ingress-nginx to the cluster
Section titled “Add ingress-nginx to the cluster”Create one ingress-nginx instance in the cluster:
22 instances.ingress-system."ingress-nginx" = {23 package = packages.experimental."ingress-nginx";24 };kix.expose requests a dependency called ingressNginx, and the package’s
meta.defaultAliases carries that name, so the lowercase ingress-nginx
instance resolves it. The instance name has to be lowercase because the
package names its resources after it. If the cluster already has one
compatible instance, use that instance instead.
The ingress-nginx Service defaults to ClusterIP. Set
config.service.spec.type = "LoadBalancer" when your environment provides
external load balancers and traffic must enter the cluster through that
Service.
Set the application hostname
Section titled “Set the application hostname”Add the application instance and set the host clients will request:
28 instances.ingress-example.web = {29 package = exposureApp;30 config.ingress.host = "web.example.test";31 };Kix resolves the ingressNginx dependency and creates an Ingress for the
application’s Service.
Check the result
Section titled “Check the result”Evaluate the cluster before deploying it:
❱ kix check how-to-platform-ingress
TOOL RESULT DETAILS
eval pass 29 manifests evaluated, 1 warnings
scorecard pass 0 errors, 12 warnings, 1 info
Warnings from the Kix library, 1:
ingress-system/ingress-nginx (experimental/ingress-nginx): package 'ingress-nginx' is deprecated: Kubernetes retired ingress-nginx in March 2026 after v1.15.1, so it no longer receives security fixes. Kix still builds this instance. Move Ingress routes to Gateway API. Use 'packages.experimental.traefik' instead
architecture.selectorCoherence (warning), 2:
ingress-system/ingress-nginx/ingress-nginx-admission: Service 'ingress-nginx-admission' has selector labels that Kix cannot trace to a workload. Use `kix.service.fromWorkload` to derive the selector and track the dependency on the workload.
ingress-system/ingress-nginx/ingress-nginx: Service 'ingress-nginx' has selector labels that Kix cannot trace to a workload. Use `kix.service.fromWorkload` to derive the selector and track the dependency on the workload.
governance.hasOwner (warning), 1:
ingress-example/web: package 'web' has no meta.owner
reliability.boundedResources (warning), 2:
ingress-example/web/web: container 'nginx' is missing resource settings: requests.cpu, requests.memory, limits.cpu, limits.memory. Set CPU and memory requests and limits. Without a memory limit, a workload can exhaust the node's memory.
ingress-system/ingress-nginx/ingress-nginx: container 'controller' is missing resource settings: limits.cpu, limits.memory. Set CPU and memory requests and limits. Without a memory limit, a workload can exhaust the node's memory.
reliability.hasProbes (warning), 2:
ingress-example/web/web: container 'nginx' has no livenessProbe
ingress-example/web/web: container 'nginx' has no readinessProbe
security.hasNetworkPolicy (warning), 2:
ingress-example: namespace 'ingress-example' has workloads but no network policy
ingress-system: namespace 'ingress-system' has workloads but no network policy
security.nonRoot (warning), 1:
ingress-example/web/web: container 'nginx' may run as root: neither it nor the pod sets securityContext.runAsNonRoot, and no non-zero runAsUser resolves for it
security.readOnlyRootfs (warning), 2:
ingress-example/web/web: container 'nginx' does not set readOnlyRootFilesystem
ingress-system/ingress-nginx/ingress-nginx: container 'controller' does not set readOnlyRootFilesystem
1 info finding(s) not listed; run with -v to list them. Inspect the generated Ingress:
❱ kix build how-to-platform-ingress --output json
{
"apiVersion": "networking.k8s.io/v1",
"kind": "Ingress",
"metadata": {
"name": "web",
"namespace": "ingress-example"
},
"spec": {
"ingressClassName": "ingress-nginx",
"rules": [
{
"host": "web.example.test",
"http": {
"paths": [
{
"backend": {
"service": {
"name": "web",
"port": {
"number": 80
}
}
},
"path": "/",
"pathType": "Prefix"
}
]
}
}
]
}
}
Warnings from the Kix library, 1:
ingress-system/ingress-nginx (experimental/ingress-nginx): package 'ingress-nginx' is deprecated: Kubernetes retired ingress-nginx in March 2026 after v1.15.1, so it no longer receives security fixes. Kix still builds this instance. Move Ingress routes to Gateway API. Use 'packages.experimental.traefik' instead The Ingress uses web.example.test, selects the ingress class exposed by the
controller instance, and sends requests for / to port 80 of the web
Service.
Before sending traffic, point the hostname at the address through which your ingress controller is reachable. The way you obtain that address depends on the cluster environment.