coreos / coreos-kubernetes

CoreOS Container Linux+Kubernetes documentation & Vagrant installers
https://coreos.com/kubernetes/docs/latest/
Apache License 2.0
1.1k stars 466 forks source link

CREATE_FAILED AWS::EFS::MountTarget Subnet0MountTarget mount target already exists in this AZ #802

Closed nicerobot closed 7 years ago

nicerobot commented 7 years ago

Following the docs and customizing cluster.yaml, i reach

# Create MountTargets for a pre-existing Elastic File System (Amazon EFS). Enter the resource id, eg "fs-47a2c22e"
# This is a NFS share that will be available across the entire cluster through a hostPath volume on the "/efs" mountpoint
#
# You can create a new EFS volume using the CLI:
# $ aws efs create-file-system --creation-token $(uuidgen)
# elasticFileSystemId: fs-47a2c22e

If i specify my existing elasticFileSystemId which is already in use and allocated to the subnets I'm specifying for the AWS-native auto-scaling:

subnets:
  - availabilityZone: us-east-1b
    instanceCIDR: "10.0.190.0/24"
  - availabilityZone: us-east-1d
    instanceCIDR: "10.0.191.0/24"
elasticFileSystemId: fs-XXXXXXXX

It appears that kube-aws is attempting to mount the subnets to my existing EFS which causes it to fail:

Creating AWS resources. This should take around 5 minutes.
Error: Error creating cluster: Stack creation failed: CREATE_FAILED : The following resource(s) failed to create: [Subnet1MountTarget, IAMInstanceProfileWorker, Subnet0MountTarget, ExternalDNS, IAMInstan
ceProfileController, IAMInstanceProfileEtcd].

Printing the most recent failed stack events:
CREATE_FAILED AWS::CloudFormation::Stack spatial-kube The following resource(s) failed to create: [Subnet1MountTarget, IAMInstanceProfileWorker, Subnet0MountTarget, ExternalDNS, IAMInstanceProfileControl
ler, IAMInstanceProfileEtcd].
CREATE_FAILED AWS::EFS::MountTarget Subnet1MountTarget mount target already exists in this AZ
CREATE_FAILED AWS::EFS::MountTarget Subnet0MountTarget mount target already exists in this AZ

I've removed the following from stack-template.json:

{{if $.ElasticFileSystemID}}
,
"{{$subnetLogicalName}}MountTarget": {
  "Properties" : {
    "FileSystemId": "{{$.ElasticFileSystemID}}",
    "SubnetId": { "Ref": "{{$subnetLogicalName}}" },
    "SecurityGroups": [ { "Ref": "SecurityGroupMountTarget" } ]
  },
  "Type" : "AWS::EFS::MountTarget"
}
{{end}}

But maybe there should be another flag that asks whether to mount.

mumoshu commented 7 years ago

@nicerobot Hi, thanks for trying kube-aws! Would you mind re-creating this issue in the kube-aws repo?

Also, I'm not yet sure what your use-case is. Maybe a silly question but may I ask you why you can't just omit elasticFileSystemId? My guess is that you'd like kube-aws to not create a mount target for you and you'd like to manually modify the existing mount target after kube-aws up completes?

nicerobot commented 7 years ago

@mumoshu Sure. I created coreos/kube-aws/issues/208.

Well, this is my use of kube-aws and I was just enabling things that I thought might be useful :) I suppose if i can enable it after the fact, that's certainly an option.