Panfactum LogoPanfactum
Infrastructure ModulesSubmodulesKuberneteskube_service
kube_service
Stable
Submodule
Source Code Link

Kubernetes Service

Provides a pre-configured instance of a Kubernetes Service.

This is currently only meant to be used as an internal Panfactum submodule.

We do not recommend using this directly.

Providers

The following providers are needed by this module:

  • kubectl (2.0.4)

  • kubernetes (2.27.0)

Required Inputs

The following input variables are required:

match_labels

Description: The label selector to use for pods backing the Service

Type: map(string)

name

Description: The name of this Service

Type: string

namespace

Description: The namespace the Service will be created in.

Type: string

Optional Inputs

The following input variables are optional (have default values):

external_traffic_policy

Description: The ExternalTrafficPolicy of the Service.

Type: string

Default: "Cluster"

extra_annotations

Description: Extra annotations to add to the Service.

Type: map(string)

Default: {}

extra_labels

Description: Extra labels to add to the Service.

Type: map(string)

Default: {}

headless_enabled

Description: Set to true iff setting up a StatefulSet headless service.

Type: bool

Default: false

internal_traffic_policy

Description: The InternalTrafficPolicy of the Service.

Type: string

Default: "Cluster"

load_balancer_class

Description: Iff type == LoadBalancer, the loadBalancerClass to use.

Type: string

Default: "service.k8s.aws/nlb"

ports

Description: The port configuration. Keys are the port names, and the values are the port configuration.

Type:

map(object({
    pod_port     = number                  # Port on the backing pods that traffic should be routed to
    service_port = optional(number, null)  # Port to expose on the service. defaults to pod_port
    protocol     = optional(string, "TCP") # One of TCP, UDP, or SCTP
  }))

Default: {}

public_domain_names

Description: Iff type == LoadBalancer, the public domains names that this service will be accessible from.

Type: list(string)

Default: []

service_ip

Description: If provided, the service will be statically bound to this IP address. Must be within the Service IP CIDR range for the cluster.

Type: string

Default: null

type

Description: The type of the Service.

Type: string

Default: "ClusterIP"

Outputs

No outputs.

Maintainer Notes

No notes.