# InstanceProvisionFailed @ Machine while trying to create cluster with clusterAPI in k8s

**URL:** https://discuss.kubernetes.io/t/instanceprovisionfailed-machine-while-trying-to-create-cluster-with-clusterapi-in-k8s/19066
**Category:** General Discussions
**Created:** [February 14, 2022, 8:55am UTC](https://discuss.kubernetes.io/t/instanceprovisionfailed-machine-while-trying-to-create-cluster-with-clusterapi-in-k8s/19066 "2022-02-14T08:55:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Dipendra\_Chaudhary](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/dipendra_chaudhary/32/9517_2.png) [@Dipendra\_Chaudhary](https://discuss.kubernetes.io/u/Dipendra_Chaudhary)
#### Post date: [February 14, 2022, 8:55am UTC](https://discuss.kubernetes.io/t/instanceprovisionfailed-machine-while-trying-to-create-cluster-with-clusterapi-in-k8s/19066/1 "2022-02-14T08:55:20Z")

</div>

I’m trying to create and manage eks cluster using clusterAPI.  
I have applied the yaml file with cluster name c1-eks.  
This is the yaml file

```auto
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: c1-eks
  namespace: default
spec:
  clusterNetwork:
    pods:
      cidrBlocks:
      - 192.168.0.0/16
  controlPlaneRef:
    apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    kind: KubeadmControlPlane
    name: c1-eks-control-plane
  infrastructureRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: AWSCluster
    name: c1-eks
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSCluster
metadata:
  name: c1-eks
  namespace: default
spec:
  region: us-east-1
  sshKeyName: default
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
  name: c1-eks-control-plane
  namespace: default
spec:
  kubeadmConfigSpec:
    clusterConfiguration:
      apiServer:
        extraArgs:
          cloud-provider: aws
      controllerManager:
        extraArgs:
          cloud-provider: aws
    initConfiguration:
      nodeRegistration:
        kubeletExtraArgs:
          cloud-provider: aws
        name: '{{ ds.meta_data.local_hostname }}'
    joinConfiguration:
      nodeRegistration:
        kubeletExtraArgs:
          cloud-provider: aws
        name: '{{ ds.meta_data.local_hostname }}'
  machineTemplate:
    infrastructureRef:
      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
      kind: AWSMachineTemplate
      name: c1-eks-control-plane
  replicas: 3
  version: v1.23.3
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSMachineTemplate
metadata:
  name: c1-eks-control-plane
  namespace: default
spec:
  template:
    spec:
      iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io
      instanceType: t3.large
      sshKeyName: default
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
  name: c1-eks-md-0
  namespace: default
spec:
  clusterName: c1-eks
  replicas: 3
  selector:
    matchLabels: null
  template:
    spec:
      bootstrap:
        configRef:
          apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
          kind: KubeadmConfigTemplate
          name: c1-eks-md-0
      clusterName: c1-eks
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: AWSMachineTemplate
        name: c1-eks-md-0
      version: v1.23.3
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSMachineTemplate
metadata:
  name: c1-eks-md-0
  namespace: default
spec:
  template:
    spec:
      iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io
      instanceType: t3.large
      sshKeyName: default
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
  name: c1-eks-md-0
  namespace: default
spec:
  template:
    spec:
      joinConfiguration:
        nodeRegistration:
          kubeletExtraArgs:
            cloud-provider: aws
          name: '{{ ds.meta_data.local_hostname }}'

```

This is the result of `kubectl get cluster`

```auto
$ kubectl get cluster
NAME PHASE AGE VERSION
c1-eks Provisioned 34m

```

When I describe cluster with clusterctl it shows error and says `InstanceProvisionFailed`

```auto
clusterctl describe cluster c1-eks
NAME READY SEVERITY REASON SINCE MESSAGE                                                            
/c1-eks False Error InstanceProvisionFailed @ Machine/c1-eks-control-plane-w5rrd 29m 1 of 2 completed                                                   
├─ClusterInfrastructure - AWSCluster/c1-eks True 29m                                                                       
├─ControlPlane - KubeadmControlPlane/c1-eks-control-plane False Error InstanceProvisionFailed @ Machine/c1-eks-control-plane-w5rrd 29m 1 of 2 completed                                                   
│ └─Machine/c1-eks-control-plane-w5rrd False Error InstanceProvisionFailed 29m 1 of 2 completed                                                   
└─Workers                                                                                                                                                                                                           
  └─MachineDeployment/c1-eks-md-0 False Warning WaitingForAvailableMachines 34m Minimum availability requires 3 replicas, current 0 available      
    └─3 Machines... False Info WaitingForBootstrapData 29m See c1-eks-md-0-66c5f554ff-96qd8, c1-eks-md-0-66c5f554ff-mvnxw, ...

```

This is the result of `kubectl describe Machine/c1-eks-control-plane-w5rrd`

```auto
$ kubectl describe Machine/c1-eks-control-plane-w5rrd
Name: c1-eks-control-plane-w5rrd
Namespace: default
Labels: cluster.x-k8s.io/cluster-name=c1-eks
              cluster.x-k8s.io/control-plane=
Annotations: controlplane.cluster.x-k8s.io/kubeadm-cluster-configuration:
                {"etcd":{},"networking":{},"apiServer":{"extraArgs":{"cloud-provider":"aws"}},"controllerManager":{"extraArgs":{"cloud-provider":"aws"}},"...
API Version: cluster.x-k8s.io/v1beta1
Kind: Machine
Metadata:
  Creation Timestamp: 2022-02-14T07:59:00Z
  Finalizers:
    machine.cluster.x-k8s.io
  Generation: 2
  Managed Fields:
    API Version: cluster.x-k8s.io/v1beta1
    Fields Type: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:controlplane.cluster.x-k8s.io/kubeadm-cluster-configuration:
        f:finalizers:
          .:
          v:"machine.cluster.x-k8s.io":
        f:labels:
          .:
          f:cluster.x-k8s.io/cluster-name:
          f:cluster.x-k8s.io/control-plane:
        f:ownerReferences:
          .:
          k:{"uid":"1b2843be-184d-405d-88b6-1694a1fff5c4"}:
            .:
            f:apiVersion:
            f:blockOwnerDeletion:
            f:controller:
            f:kind:
            f:name:
            f:uid:
      f:spec:
        .:
        f:bootstrap:
          .:
          f:configRef:
            .:
            f:apiVersion:
            f:kind:
            f:name:
            f:namespace:
            f:uid:
          f:dataSecretName:
        f:clusterName:
        f:failureDomain:
        f:infrastructureRef:
          .:
          f:apiVersion:
          f:kind:
          f:name:
          f:namespace:
          f:uid:
        f:version:
      f:status:
        .:
        f:bootstrapReady:
        f:conditions:
        f:lastUpdated:
        f:observedGeneration:
        f:phase:
    Manager: manager
    Operation: Update
    Time: 2022-02-14T07:59:01Z
  Owner References:
    API Version: controlplane.cluster.x-k8s.io/v1beta1
    Block Owner Deletion: true
    Controller: true
    Kind: KubeadmControlPlane
    Name: c1-eks-control-plane
    UID: 1b2843be-184d-405d-88b6-1694a1fff5c4
  Resource Version: 31839
  UID: 76bdc88e-8251-4031-b935-1b8a11b3412c
Spec:
  Bootstrap:
    Config Ref:
      API Version: bootstrap.cluster.x-k8s.io/v1beta1
      Kind: KubeadmConfig
      Name: c1-eks-control-plane-wrjqd
      Namespace: default
      UID: 272eba72-943d-4ff6-973b-869b92677caf
    Data Secret Name: c1-eks-control-plane-wrjqd
  Cluster Name: c1-eks
  Failure Domain: us-east-1b
  Infrastructure Ref:
    API Version: infrastructure.cluster.x-k8s.io/v1beta1
    Kind: AWSMachine
    Name: c1-eks-control-plane-zvdbx
    Namespace: default
    UID: 7c4bd14c-5931-4bd9-a1d5-ba4846b02c95
  Version: v1.23.3
Status:
  Bootstrap Ready: true
  Conditions:
    Last Transition Time: 2022-02-14T07:59:03Z
    Message: 1 of 2 completed
    Reason: InstanceProvisionFailed
    Severity: Error
    Status: False
    Type: Ready
    Last Transition Time: 2022-02-14T07:59:01Z
    Status: True
    Type: BootstrapReady
    Last Transition Time: 2022-02-14T07:59:03Z
    Message: 0 of 3 completed
    Reason: InstanceProvisionFailed
    Severity: Error
    Status: False
    Type: InfrastructureReady
    Last Transition Time: 2022-02-14T07:59:01Z
    Reason: WaitingForNodeRef
    Severity: Info
    Status: False
    Type: NodeHealthy
  Last Updated: 2022-02-14T07:59:01Z
  Observed Generation: 2
  Phase: Provisioning
Events: <none>

```

And `kubeadmcontrolplane` is also not initialized. This doesn’t let to apply yhe CNI solution in the cluster.

```auto
kubectl get kubeadmcontrolplane
NAME CLUSTER INITIALIZED API SERVER AVAILABLE REPLICAS READY UPDATED UNAVAILABLE AGE VERSION
c1-eks-control-plane c1-eks 1 1 1 27m v1.23.3

```

Please HELP!

---

<div class="post-metadata">

### Author: ![duebina](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/duebina/32/16196_2.png) [@duebina](https://discuss.kubernetes.io/u/duebina)
#### Post date: [November 5, 2024, 5:03pm UTC](https://discuss.kubernetes.io/t/instanceprovisionfailed-machine-while-trying-to-create-cluster-with-clusterapi-in-k8s/19066/2 "2024-11-05T17:03:04Z")

</div>

I am also experiencing this issue. Any help would be appreciated!
