We use Terraform to create all of our infrastructure resources then we use Helm to deploy apps in our cluster.
We're looking for a way to streamline the creation of infra and apps, so currently this is what we do:
loadBalancerIP:
spec on our ingress controller helm chartIf at all possible, I'd like to store the generated public IP somewhere via terraform (config map would be nice), and then reference that in the ingress service loadBalancerIP:
spec, so the end to end process is sorted.
I know configmaps are for pods and I don't think they can be used for kubernetes service objects - does anyone have any thoughts/ideas on how I could achieve this?
I suggest creating a static public IP in GCP using terraform by specifying the name you want like this:
module "address" {
source = "terraform-google-modules/address/google"
version = "3.0.0"
project_id = "your-project-id"
region = "your-region"
address_type = "EXTERNAL"
names = [ "the-name-you-want" ]
global = true
}
You can then refer to this static public IP name
in the Kubernetes ingress resource by specifying the annotations kubernetes.io/ingress.global-static-ip-name: "the-name-you-want"
like this:
resource "kubernetes_ingress_v1" "example" {
wait_for_load_balancer = true
metadata {
name = "example"
namespace = "default"
annotations = {
"kubernetes.io/ingress.global-static-ip-name" = "the-name-you-want"
}
}
spec {
....
This will create ingress resource 'example' in GKE and attach static public IP named 'the-name-you-want' to it.