Machine

This section describes the Machine resource used in Mirantis Container Cloud API. The Machine resource describes the machine-level parameters.

For demonstration purposes, the Container Cloud the Machine custom resource (CR) can be split into the following major sections:

metadata

The Container Cloud Machine custom resource (CR) contains the following fields:

  • apiVersion

    cluster.k8s.io/v1alpha1

  • kind

    Object type that is Machine

The metadata object field of the Machine resource contains the following fields:

  • name

    Name of the Machine object

  • namespace

    Namespace where the machine has been created

  • labels

    • kaas.mirantis.com/provider

      Provider type that is aws for AWS machines and matches the provider type in the Cluster object

    • kaas.mirantis.com/region

      Region name that matches the region name in the Cluster object

    • cluster.sigs.k8s.io/cluster-name

      Cluster name that a machine is linked to

    • cluster.sigs.k8s.io/control-plane

      • For the control plane role of a machine, this label contains any value, for example, "true"

      • For the worker role, this label is absent or does not contain any value

Configuration example:

apiVersion: cluster.k8s.io/v1alpha1
kind: Machine
metadata:
  name: example-control-plane
  namespace: example-ns
  labels:
    kaas.mirantis.com/provider: aws
    kaas.mirantis.com/region: region-one
    cluster.sigs.k8s.io/cluster-name: example-cluster
    cluster.sigs.k8s.io/control-plane: "true" # remove for worker

spec:providerSpec for instance configuration

The spec object field of the Machine object represents the AWSMachineProviderSpec subresource with all required details to create an AWS instance. It contains the following fields:

  • apiVersion

    aws.kaas.mirantis.com/v1alpha1.

  • kind

    AWSMachineProviderSpec.

  • ami

    Reference to the Amazon Machine Image (AMI):

    • id - AMI ID to create a machine instance from.

  • instanceType

    Type of instance to create.

  • rootDeviceSize

    Size of the root volume.

  • nodeLabels

    List of node labels to be attached to a node for the user to run certain components on separate cluster nodes. The list of allowed node labels is located in the cluster status providerStatus.releaseRef.current.allowedNodeLabels field. Adding of a node label that is not available in the list of allowed node labels is restricted.

Configuration example:

providerSpec:
  value:
    ami:
      id: ami-033a0960d9d83ead0
    apiVersion: aws.kaas.mirantis.com/v1alpha1
    instanceType: c5d.2xlarge
    kind: AWSMachineProviderSpec
    rootDeviceSize: 120
    nodeLabels:
    - key: openstack-control-plane
      value: enable

status:providerStatus

The status object field of the Machine object represents the AWSMachineProviderStatus subresource that describes the current state of an AWS instance and contains the following fields:

  • apiVersion

    aws.kaas.mirantis.com/v1alpha1

  • kind

    AWSMachineProviderStatus

  • conditions

    List of a machine status conditions:

    • type

      Object type

    • ready

      Readiness flag

    • message

      Status details

  • providerInstanceState

    Current state of an AWS instance:

    • id

      ID of an AWS instance

    • ready

      Readiness flag

    • state

      State of an AWS instance

  • instanceID

    Instance ID of a machine created in AWS

  • instanceState

    State of an AWS instance linked to a machine

  • privateIp

    Private IPv4 address assigned to an instance

  • status

    Current status of a machine:

    • Provision

      A machine is yet to obtain a status

    • Uninitialized

      A machine is yet to obtain the node IP address and host name

    • Pending

      A machine is yet to receive the deployment instructions and it is either not booted yet or waits for the LCM controller to be deployed

    • Prepare

      A machine is running the Prepare phase during which Docker images and packages are being predownloaded

    • Deploy

      A machine is processing the LCM controller instructions

    • Reconfigure

      Some configurations are being updated on a machine

    • Ready

      A machine is deployed and the MKE version is set

Configuration example:

status:
  providerStatus:
    apiVersion: aws.kaas.mirantis.com/v1alpha1
    ...
    kind: AWSMachineProviderStatus
    conditions:
     - message: Kubelet's NodeReady condition is True
       ready: true
       type: Kubelet
     - message: Swarm state of the machine is ready
       ready: true
       type: Swarm
     - message: LCM Status of the machine is Ready
       ready: true
       type: LCM
       ...
    providerInstanceState:
       id: i-0f75ac03025191073
       ready: true
       state: running
    ...
    hardware: {}
    instanceID: i-01125dc27ec5e5c1a
    instanceState: running
    kind: AWSMachineProviderStatus
    privateIp: 10.0.0.234
    status: Ready