How-to guide / Platform capabilities
Add TLS through a cluster issuer
When a package uses kix.expose, Kix can add TLS to its Ingress from the
cluster’s clusterIssuer dependency. cert-manager then creates and renews the
certificate Secret named by that Ingress.
This path requires an ingress-nginx provider and a ready ClusterIssuer. Gateway API listeners manage TLS separately and do not use this integration.
Make the package exposable
Section titled “Make the package exposable”Declare the standard ingress options:
21 options.ingress = kix.options.ingress;Add kix.expose to the package build and point it at the Service part:
56 (kix.expose { service = "service"; })kix.expose has optional dependencies on ingressNginx and
clusterIssuer. With ingress-nginx alone it emits an HTTP Ingress. When a
ClusterIssuer is also available, it adds:
cert-manager.io/cluster-issuerwith the selected issuer name.- An Ingress TLS entry for the configured host, with the Secret
<instance>-tls.
Add the issuer to the cluster
Section titled “Add the issuer to the cluster”Install cert-manager and configure the issuer:
109 instances.cert-manager.cert-manager = {110 package = packages.cert-manager;111 };112
113 # A Secret created outside Kix that holds the Cloudflare API token114 # under the key `api-token`.115 instances.cert-manager.cloudflare-api-token = {116 package = packages.secret-ref;117 config.keys = [ "api-token" ];118 };119
120 instances.cert-manager.letsencrypt = {121 package = packages.cluster-issuer;122 deps.issuerCredentials = ref.cert-manager.cloudflare-api-token;123 config.spec.acme = {124 server = "https://acme-v02.api.letsencrypt.org/directory";125126 solvers = [127 {128 dns01.cloudflare.apiTokenSecretRef.key = "api-token";129 selector.dnsZones = [ "example.com" ];130 }131 ];132 };133 };The cluster-issuer package declares clusterIssuer as a default alias, so
TLS-capable packages resolve it without per-application deps entries.
Exactly one instance should answer clusterIssuer; give any other issuer,
such as a staging one, its own aliases.
See Configure cert-manager issuers for the credential and self-signed configurations.
Set the application host
Section titled “Set the application host”Configure the application hostname:
210 instances.apps.web = {211 package = webPackage;212 config.ingress.host = "web.example.com";213 };If config.ingress.host is null, kix.expose can derive
<instance>.<cluster.domain> when the cluster sets cluster.domain. Set the
host explicitly when DNS or certificate policy requires a particular name.
Verify the generated Ingress
Section titled “Verify the generated Ingress”Check the cluster and render the manifests before deployment:
❱ kix check doc-how-tos❱ kix build doc-how-tos In the rendered Ingress, confirm that metadata.annotations includes
cert-manager.io/cluster-issuer and that spec.tls sets your hostname and
<instance>-tls Secret name.
After deployment, verify the Certificate and Secret created by cert-manager:
❱ kubectl -n apps get certificate,secret❱ kubectl -n apps describe certificate web-tls cert-manager creates the <instance>-tls Secret in the Ingress’s namespace,
which is where the Ingress reads it.