Search code examples
amazon-web-servicesautoscalingkops

What is the difference between machineType and mixedInstancesPolicy


Does anybody know when creating InstanceGroup using kops, why we set both machineType and mixedInstancesPolicy? Does machineType means kops will pick machineType by default but if no instance with machineType available it will pick one of the types from mixedInstancesPolicy?

The spec: https://kops.sigs.k8s.io/instance_groups/ shows: "A Mixed Instances Policy utilizing EC2 Spot and the capacity-optimized allocation strategy allows an EC2 Autoscaling Group to select the instance types with the highest capacity. This reduces the chance of a spot interruption on your instance group."

the spec does not show what machineType is and what is the difference of machineType and mixedInstancesPolicy.

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
...
spec:
  image: kope.io/k8s-1.16-debian-...
  machineType: m5.xlarge
  maxSize: XX
  minSize: XX
  mixedInstancesPolicy:
    instances:
    - m4.xlarge
    - r4.xlarge
    - c4.xlarge

Solution

  • mixedInstancesPolicy is as described above. machineType is used if you do want one specific instance type.

    There is a bit of terminology mix-up there. But you can see machineType as the same as instanceType.

    If both are set, mixedInstancesPolicy is the on that will be used. However, machineType must is still validated and must e.g match the architecture of the instances in mixedInstancesPolicy.