rancher / quickstart

378 stars 328 forks source link

Request use of AWS Elastic IP support #223

Open kevinayres opened 11 months ago

kevinayres commented 11 months ago

Issue: By using a public IP (not EIP), things like Nginx are bound to that temporary IP. If you shutdown/start the instance, you get a different IP resulting in 'bad gateway' when accessing the API.

One way this project could be even more helpful would be to support EIP on deployment. Example:

kevinayres commented 11 months ago

This works for creating the instance, EIP, association:

Providers

provider "aws" { profile = "default" }

Variable Declarations

variable "ami-sles15sp5payg" { type = string default = "ami-0aa3dc9f3f70b91a7" #AMI for us-west-1 }

variable "key-name" { type = string default = "access" }

Create EC2 instance

resource "aws_instance" "demo-instance" { ami = var.ami-sles15sp5payg instance_type = "t2.micro" key_name = var.key-name }

Resource block for eip

resource "aws_eip" "demo-1" { vpc = true }

Associate the EIP

resource "aws_eip" "demo-2" { instance = aws_instance.demo-instance.id vpc = true } `

strophy commented 1 month ago

I ran into this problem as well. I shut down the two instances to save money over the weekend, and when they powered up again, they received different IP addresses. terraform destroy now fails with:

╷
│ Error: Kubernetes cluster unreachable: Get "https://13.38.67.225:6443/version": dial tcp 13.38.67.225:6443: i/o timeout
│ 
│   with module.rancher_common.helm_release.cert_manager,
│   on ../rancher-common/helm.tf line 4, in resource "helm_release" "cert_manager":
│    4: resource "helm_release" "cert_manager" {
│ 
╵

Now I have to manually dig around and destroy the infrastructure I was using to evaluate Rancher. It would be great if the quickstart could be refactored to get the current IP before attempting helm operations in Terraform, or just use an EIP as suggested above.