kubernetes / kops

Kubernetes Operations (kOps) - Production Grade k8s Installation, Upgrades and Management
https://kops.sigs.k8s.io/
Apache License 2.0
15.94k stars 4.65k forks source link

KOPS Changing the name of my exisiting AWS Key Pair #9875

Closed iamaverrick closed 3 years ago

iamaverrick commented 4 years ago

we are using Terraform v0.12.29 also have tried V0.13 to manage our production environment on aws. On top of that we are also using KOPS Version 1.18.0 (git-698bf974d8) to deploy terraform outputs. my current issue is when i generate the terraform outputs KOPS is rename the AWS Key pair for some reason instead of using the provided name of the key pair. we want to use are our key pair name, and keys but im not sure if this is an issue with the new versions because i didn't have this issue with previous terraform nor kops versions.

my configuration is as follows:

output "kops_create_cluster" {
  value = <<EOF
      kops create cluster\
      --name=k8s.${var.domain}\
      --state=s3://kops.${var.domain}\
      --cloud=${var.kops_cloud}\
      --kubernetes-version=${var.kops_k8s_version}\
      --cloud-labels="${var.kops_cloud_labels}"\
      --dns-zone=${var.zone_id}\
      --encrypt-etcd-storage=${var.kops_encrypt_etcd_storage}\
      --master-count=${var.kops_master_count}\
      --master-size=${var.kops_master_size}\
      --master-zones=${data.terraform_remote_state.vpc.outputs.azs[1]},${data.terraform_remote_state.vpc.outputs.azs[2]},${data.terraform_remote_state.vpc.outputs.azs[3]}\
      --master-security-groups=${data.terraform_remote_state.sg.outputs.web_sg_id},${data.terraform_remote_state.sg.outputs.k8s_api_sg_id}\
      --master-volume-size=${var.kops_master_volume_size}\
      --networking=${var.kops_networking}\
      --node-security-groups=${data.terraform_remote_state.sg.outputs.web_sg_id},${data.terraform_remote_state.sg.outputs.k8s_api_sg_id}\
      --node-count=${var.kops_node_count}\
      --node-size=${var.kops_node_size}\
      --zones=${data.terraform_remote_state.vpc.outputs.azs[1]},${data.terraform_remote_state.vpc.outputs.azs[2]},${data.terraform_remote_state.vpc.outputs.azs[3]}\
      --topology=${var.kops_topology}\
      --utility-subnets=${data.terraform_remote_state.vpc.outputs.public_subnets[1]},${data.terraform_remote_state.vpc.outputs.public_subnets[2]},${data.terraform_remote_state.vpc.outputs.public_subnets[3]}\
      --subnets=${data.terraform_remote_state.vpc.outputs.private_subnets[1]},${data.terraform_remote_state.vpc.outputs.private_subnets[2]},${data.terraform_remote_state.vpc.outputs.private_subnets[3]}\
      --ssh-public-key=${data.terraform_remote_state.key_pair.outputs.k8s_key_public_key_filename}\
      --yes\
      --vpc=${data.terraform_remote_state.vpc.outputs.vpc_id}\
      --out=${var.kops_output_dir}\
      --target=${var.kops_target}
EOF

}

the name of the key pair is something like i.g key.pub kops is changing it to kubernetes.k8s.company.com-finger-printsss

is anybody having the same issue or can somebody reproduce thanks in advance

Reasons why

Reasons why i suspect its kops change the name is because when i cd into the location output folder a folder is created called data and in that file all the information is located in regards to the output. updated name of the key pair is located their

iamaverrick commented 4 years ago

Looks like im still having this issue:

KOPS Version Version 1.18.1 (git-453d7d96be)

Terraform Version

Terraform v0.13.2
+ provider registry.terraform.io/hashicorp/aws v3.5.0

K8s Version --kubernetes-version=1.18.8

There isn't a reason why kops should be trying to recreate the name of the AWS Key Pair provided example described below

  # aws_key_pair.kubernetes-k8s-companyr.com-b9ec10434548451554541dbceb163f45 will be created
  + resource "aws_key_pair" "kubernetes-k8s-companyr.com-b9ec10434548451554541dbceb163f45" {
      + arn         = (known after apply)
      + fingerprint = (known after apply)
      + id          = (known after apply)
      + key_name    = "kubernetes.k8s.companyr.com-b9:ec:09:43:96:59:24:e2:15:90:9d:bc:eb:16:3f:30"
      + key_pair_id = (known after apply)
      + public_key  = "ssh-rsa 
    }
rifelpet commented 4 years ago

What is the exact value of data.terraform_remote_state.key_pair.outputs.k8s_key_public_key_filename? And can you run kops get cluster --name $clustername -o yaml ? I'd like to see the value of sshKeyName

fejta-bot commented 3 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot commented 3 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot commented 3 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community. /close

k8s-ci-robot commented 3 years ago

@fejta-bot: Closing this issue.

In response to [this](https://github.com/kubernetes/kops/issues/9875#issuecomment-789310387): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >Send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.