This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

AWS

The customizations in this section are applicable only to AWS clusters. They will only be applied to clusters that use the AWS infrastructure provider, i.e. a CAPI Cluster that references an AWSCluster.

1 - AWS Additional Security Group Spec

The AWS additional security group customization allows the user to specify security groups to the created machines. The customization can be applied to both control plane and nodepool machines. This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To specify addiitonal security groups for all control plane and nodepools, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          controlPlane:
            aws:
              additionalSecurityGroups:
              - id: "sg-0fcfece738d3211b8"
      - name: workerConfig
        value:
          aws:
            additionalSecurityGroups:
            - id: "sg-0fcfece738d3211b8"

We can further customize individual MachineDeployments by using the overrides field with the following configuration:

spec:
  topology:
    # ...
    workers:
      machineDeployments:
        - class: default-worker
          name: md-0
          variables:
            overrides:
              - name: workerConfig
                value:
                  aws:
                    additionalSecurityGroups:
                    - id: "sg-0fcfece738d3211b8"

Applying this configuration will result in the following value being set:

  • control-plane AWSMachineTemplate:

    • spec:
        template:
          spec:
            additionalSecurityGroups:
            - id: sg-0fcfece738d3211b8
      
  • worker AWSMachineTemplate:

    • spec:
        template:
          spec:
            additionalSecurityGroups:
            - id: sg-0fcfece738d3211b8
      

2 - AWS AMI ID and Format spec

The AWS AMI customization allows the user to specify the AMI or AMI Lookup arguments for a AWS machine. The AMI customization can be applied to both control plane and nodepool machines. This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To specify the AMI ID or format for all control plane and nodepools, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          controlPlane:
            aws:
              ami:
                # Specify one of id or lookup.
                id: "ami-controlplane"
                # lookup:
                #   format: "my-cp-ami-{{.BaseOS}}-?{{.K8sVersion}}-*"
                #   org: "123456789"
                #   baseOS: "ubuntu-20.04"
      - name: workerConfig
        value:
          aws:
            ami:
              # Specify one of id or lookup.
              id: "ami-allWorkers"
              # lookup:
              #   format: "my-default-workers-ami-{{.BaseOS}}-?{{.K8sVersion}}-*"
              #   org: "123456789"
              #   baseOS: "ubuntu-20.04"

We can further customize individual MachineDeployments by using the overrides field with the following configuration:

spec:
  topology:
    # ...
    workers:
      machineDeployments:
        - class: default-worker
          name: md-0
          variables:
            overrides:
              - name: workerConfig
                value:
                   ami:
                    # Specify one of id or lookup.
                    id: "ami-customWorker"
                    # lookup:
                    #   format: "gpu-workers-ami-{{.BaseOS}}-?{{.K8sVersion}}-*"
                    #   org: "123456789"
                    #   baseOS: "ubuntu-20.04"

Applying this configuration will result in the following value being set:

  • control-plane AWSMachineTemplate:

    • spec:
        template:
          spec:
            ami: ami-controlplane
            # lookupFormat: "my-default-workers-ami-{{.BaseOS}}-?{{.K8sVersion}}-*"
            # lookupOrg: "123456789"
            # lookupBaseOS: "ubuntu-20.04"
      
  • worker AWSMachineTemplate:

    • spec:
        template:
          spec:
            ami: ami-customWorker
            # lookupFormat: "gpu-workers-ami-{{.BaseOS}}-?{{.K8sVersion}}-*"
            # lookupOrg: "123456789"
            # lookupBaseOS: "ubuntu-20.04"
      

3 - Control Plane Load Balancer

The control-plane load balancer customization allows the user to modify the load balancer configuration for the control-plane's API server.

This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To use an internal ELB scheme, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          aws:
            controlPlaneLoadBalancer:
              scheme: internal

Applying this configuration will result in the following value being set:

  • AWSClusterTemplate:

    • spec:
        controlPlaneLoadBalancer:
          scheme: internal
      

4 - IAM Instance Profile

The IAM instance profile customization allows the user to specify the profile to use for control-plane and worker Machines.

This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To specify the IAM instance profile, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          controlPlane:
            aws:
              iamInstanceProfile: custom-control-plane.cluster-api-provider-aws.sigs.k8s.io
      - name: workerConfig
        value:
          aws:
            iamInstanceProfile: custom-nodes.cluster-api-provider-aws.sigs.k8s.io

Applying this configuration will result in the following value being set:

  • control-plane AWSMachineTemplate:

    • spec:
        template:
          spec:
            iamInstanceProfile: custom-control-plane.cluster-api-provider-aws.sigs.k8s.io
      
  • worker AWSMachineTemplate:

    • spec:
        template:
          spec:
            iamInstanceProfile: custom-nodes.cluster-api-provider-aws.sigs.k8s.io
      

5 - Instance type

The instance type customization allows the user to specify the profile to use for control-plane and worker Machines.

This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To specify the instance type, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          controlPlane:
            aws:
              instanceType: m5.xlarge
      - name: workerConfig
        value:
          aws:
            instanceType: m5.2xlarge

Applying this configuration will result in the following value being set:

  • control-plane AWSMachineTemplate:

    • spec:
        template:
          spec:
            instanceType: m5.xlarge
      
  • worker AWSMachineTemplate:

    • spec:
        template:
          spec:
            instanceType: m5.2xlarge
      

6 - Network

The network customization allows the user to specify existing infrastructure to use for the cluster.

This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To specify existing AWS VPC, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          aws:
            network:
              vpc:
                id: vpc-1234567890

To also specify existing AWS Subnets, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          aws:
            network:
              vpc:
                id: vpc-1234567890
              subnets:
                - id: subnet-1
                - id: subnet-2
                - id: subnet-3

Applying this configuration will result in the following value being set:

  • AWSClusterTemplate:

    • spec:
        network:
          subnets:
          - id: subnet-1
          - id: subnet-2
          - id: subnet-3
          vpc:
            id: vpc-1234567890
      

7 - Region

The region customization allows the user to specify the region to deploy a cluster into.

This customization will be available when the provider-specific cluster configuration patch is included in the ClusterClass.

Example

To specify the AWS region to deploy into, use the following configuration:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
  topology:
    variables:
      - name: clusterConfig
        value:
          aws:
            region: us-west-2

Applying this configuration will result in the following value being set:

  • AWSClusterTemplate:

    • spec:
        template:
          spec:
            region: us-west-2