cluster-api-provider-aws icon indicating copy to clipboard operation
cluster-api-provider-aws copied to clipboard

Failed to find AMI for AWSMachine following the documentation quick start

Open jfcavalcante opened this issue 1 year ago • 8 comments

/kind bug

What steps did you take and what happened: [A clear and concise description of what the bug is.]

After following the ClusterAPI Provider AWS Quick Start, and creating a cluster with the kubernetes version v1.29.2, as described in the documentation, I've faced the following error:

E0518 20:43:26.820802       1 awsmachine_controller.go:520] "unable to create instance" err="failed to create AWSMachine instance: failed to find ami: found no AMIs with the name: \"capa-ami-ubuntu-18.04-?1.29.2-*\""
E0518 20:43:26.839548       1 controller.go:329] "Reconciler error" err="failed to create AWSMachine instance: failed to find ami: found no AMIs with the name: \"capa-ami-ubuntu-18.04-?1.29.2-*\"" controller="awsmachine" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSMachine" AWSMachine="default/capi-quickstart-control-plane-ghxb2" namespace="default" name="capi-quickstart-control-plane-ghxb2" reconcileID="0e55d5cb-e196-4aad-8abc-3877a24209a7"

The image name string isn't being parsed correctly, and resulting in an error during reconcile.

What did you expect to happen:

The cluster to be completelly provisioned following the commands of the documentation.

Environment:

  • Cluster-api-provider-aws version: v2.5.0
  • Kubernetes version: (use kubectl version): v1.29.2
  • OS (e.g. from /etc/os-release): ubuntu v22.04.4

jfcavalcante avatar May 18 '24 20:05 jfcavalcante

This issue is currently awaiting triage.

If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar May 18 '24 20:05 k8s-ci-robot

Also tried with kubernetes in v1.27.6, same error occurs.

E0518 21:11:44.458942       1 awsmachine_controller.go:520] "unable to create instance" err="failed to create AWSMachine instance: failed to find ami: found no AMIs with the name: \"capa-ami-ubuntu-18.04-?1.27.6-*\""

jfcavalcante avatar May 18 '24 21:05 jfcavalcante

Adding the AMI ID to both AWSMachineTemplate spec solved it for me:

apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
  name: capi-quickstart-md-0
  namespace: default
spec:
  template:
    spec:
      ami:
        id: ami-0e0ff5dacd34970c0
      iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io
      instanceType: t3.large
      sshKeyName: default

jfcavalcante avatar May 18 '24 21:05 jfcavalcante

Query clusterawsadm ami list to find the available AMI versions. If you do not find the supported Kubernetes version AMI, use the latest available AMI equivalent to the latest Kubernetes version.

I encountered the same error, and the above trace resolved it for me.

athiruma avatar Jul 10 '24 21:07 athiruma

Why is it looking for capa-ami-ubuntu-18.04 where is that specified?

The quickstart guide is not working right now.

driv avatar Sep 13 '24 07:09 driv

Following the quick start as of today, I get the following error:

E1009 20:05:54.805162       1 controller.go:329] "Reconciler error" err="failed to create AWSMachine instance: failed to find ami: found no AMIs with the name: \"capa-ami-ubuntu-18.04-?1.31.0-*\"" controller="awsmachine" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="AWSMachine" AWSMachine="default/k8s-test-control-plane-xccfg" namespace="default" name="k8s-test-control-plane-xccfg" reconcileID="3e8ab730-5991-4849-bd85-36a61724864b"

Trying to list the available AMIs, I get this error:

$ clusterawsadm ami list
No AMIs found

jonatasbaldin avatar Oct 09 '24 20:10 jonatasbaldin

I have the same issue as @jonatasbaldin, and now it is impossible to deploy new clusters with capi-cluster. It seems the AWS AMIs are no longer available.

The workaround that @jfcavalcante mentioned above did not work for me. There is an option to set up the ami.id, but this ami.id needs to be customized with multiple dependencies that are not documented (at least I did not find them).

andresanaya21 avatar Oct 15 '24 07:10 andresanaya21

I don't remember exactly, but I think I only had to change the imageLookupBaseOS to be able to proceed.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
  name: capi-quickstart-control-plane-small
  namespace: default
spec:
  template:
    spec:
      iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io
      instanceType: t3.small
      sshKeyName: default
      imageLookupBaseOS: ubuntu-20.04

driv avatar Oct 15 '24 08:10 driv

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 13 '25 08:01 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Feb 12 '25 08:02 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Mar 14 '25 09:03 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Mar 14 '25 09:03 k8s-ci-robot

Same Error as others: awscluster/capi-quick1 Failed to find ami for OS=, Architecture=x86_64 and Kubernetes-version=v1.32.0: found no AMIs with the name: "capa-ami-ubuntu-24.04-?1.32.0-*"

the command: clusterawsadm ami list does not even report any ami in AWS eu-south :-(

Does that mean that those ami must be prepared by CAPI before we can use them? I must be missing something... Can anybody enlighten me? Thanks

zrml avatar Mar 19 '25 09:03 zrml

Same Error as others: awscluster/capi-quick1 Failed to find ami for OS=, Architecture=x86_64 and Kubernetes-version=v1.32.0: found no AMIs with the name: "capa-ami-ubuntu-24.04-?1.32.0-*"

the command: clusterawsadm ami list does not even report any ami in AWS eu-south :-(

Does that mean that those ami must be prepared by CAPI before we can use them? I must be missing something... Can anybody enlighten me? Thanks

@zrml. -- I remember that I had to generate the AMI with the dependencies that CAPI cluster needs to work.

andresanaya21 avatar Mar 19 '25 11:03 andresanaya21

Thanks @andresanaya21 that is painful. We should be able to at least copy the AMI from a region to another... Is there any documentation for generating ? Thank you for your time.

For posterity:

  1. adding imageLookupBaseOS: ubuntu-20.04 created a massive error that seems to hint at the fact that the API end-point was not going to accept something not defined. However, I do see the field in https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/config/crd/bases/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml

  2. removing the above and adding the other suggestion or ami: id: ami-0e0ff5dacd34970c0 I get a similar error: Error from server (Invalid): error when applying patch: {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{"apiVersion":"infrastructure.cluster.x-k8s.io/v1beta2","kind":"AWSMachineTemplate","metadata":{"annotations":{},"name":"capi-quick1-control-plane","namespace":"default"},"spec":{"template":{"spec":{"ami":{"id":"ami-0b385250c54450908"},"iamInstanceProfile":"control-plane.cluster-api-provider-aws.sigs.k8s.io","instanceType":"t3.large","sshKeyName":"default"}}}}\n"}},"spec":{"template":{"spec":{"ami":{"id":"ami-0b385250c54450908"}}}}}

zrml avatar Mar 19 '25 13:03 zrml