expose-service-ingress
alemuro/expose-service-ingress/kubernetes
Terraform module to deploy and expose a kubernetes service using Traefik
Terraform Module for exposing a service through an Ingress This module provides an easy way to deploy pods and to expose them to the Internet by configuring the proper service and ingresses. It has been designed to allow pods with only one container. See examples below. This module has been designed to work on a K3S cluster with Traefik and files stored locally. It supports cert-manager for creating Let's Encrypt certificates. Take into consideration that a ClusterIssuer with name "letsencrypt" should be created before using this module. Supported Ingresses Currently there is only one ingress supported. Feel free to open PR's to add support for others: * Traefik Providers | Name | Version | |------|---------| | kubernetes | n/a | Inputs | Name | Description | Type | Default | Required | |-
| Name | Type | Description | Default |
|---|---|---|---|
| image | string | Image name and tag to deploy. | required |
| name | string | Name used to identify deployed container and all related resources. | required |
| cloudflare_domains | list(string) | List of domains that should be exposed through Cloudflare Tunnel. Requires the i | [] |
| namespace | string | Kubernetes namespace where resources must be created. | "default" |
| service_port | string | Port configured on the service side to receive requests (routed to the container | "80" |
| capabilities_add | list(string) | List of capabilities to add to the container. | [] |
| annotations | object({ ingress = optiona | Annotations added to some components. Only ingress and service supported at the | {
"ingress": {},
"service": {}
} |
| allow_from | list(string) | List of services to allow traffic from | [] |
| configmaps | map(string) | Map with configmaps to mount in the container, where the key is the path where i | {} |
| pvcs | list(object({ name = | Object that contains the list of PVCs to mount in the container | [] |
| domains | list(string) | List of domains that should be configured to route traffic from. | [] |
| host_network | bool | Whether to run the container in host network mode. Defaults to false. | false |
| node_selector | map(string) | Node selector to use when deploying the container. | null |
| resources | object({ limits = map(st | Map with resources limits and requests. | {
"limits": {},
"requests": {}
} |
| host_port | string | Host port where to send to requests to. | null |
| pod_additional_ports | list(object({ name | List of additional ports to expose on the pod. | [] |
| paths | map(any) | Object mapping local paths to container paths | {} |
| container_port | string | Container port where to send to requests to. If doesn't exist, service won't be | null |
| environment_variables | map(any) | Map with environment variables injected to the containers. | {} |
| supplemental_groups | list(string) | List of supplemental groups to add to the container. | [] |
| https | bool | Whether to create an ingress for HTTPS traffic. | true |
| args | list(string) | List of arguments to pass to the container | [] |