Metal³

The core component behind CCD's bare metal based deployments

Lennart Jern @ Ericsson Software Technology Finland

10th May 2022

metal3.io

What is Metal³?

The Metal³ project (pronounced: “Metal Kubed”) provides components for bare metal host management with Kubernetes. You can enroll your bare metal machines, provision operating system images, and then, if you like, deploy Kubernetes clusters to them.

Components:

  • BareMetal Operator (BMO)
  • Cluster API Provider Metal³ (CAPM3)
  • IP Address Manager (IPAM)

Builds on and integrates with:

  • Ironic
  • Ironic Python Agent (IPA)
  • Cluster API

Metal³

Metal³

Metal³

Custom Controllers and Objects

Cluster-api

Cluster
Controller

BareMetal

Host
 

Metal3

Machine

Machine

Metal3

Cluster

Cluster

Kubeadm

Config

Machine
Controller

Metal3
Cluster
Controller

Metal3
Machine
Controller

Cluster-api-

provider-metal3

Baremetal
Operator

Cluster API
Provider
Kubeadm

Object Refernce

Reconcile

apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: Metal3Cluster
metadata:
  name: example_cluster
spec:
  controlPlaneEndpoint:
    host: 192.168.111.249
    port: 6443

Metal3Cluster

Metal³

apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: Metal3Machine
metadata:
  annotations:
    metal3.io/BareMetalHost: metal3/node-0
  finalizers:
  - metal3machine.infrastructure.cluster.x-k8s.io
  name: test1-controlplane-s6tdz
  namespace: metal3
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1alpha3
    blockOwnerDeletion: true
    controller: true
    kind: Machine
    name: test1-jntbq
spec:
  hostSelector: {}
  image:
    checksum: https://cloud.centos.org/centos/8/x86_64/images/CentOS-8.md5sum
    checksumType: md5
    format: raw
    url: https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2
  providerID: metal3://fc5847cc-7cde-46f5-a4f4-99024439f6a4
status:
  addresses:
  - address: 192.168.111.20
    type: InternalIP
  - address: 172.22.0.66
    type: InternalIP
  - address: node-0
    type: Hostname
  - address: node-0
    type: InternalDNS
  ready: true

Metal3Machine

Metal³

Metal³ Stack

Metal³

management

storage

compute

network

Ironic documentation : https://docs.openstack.org/ironic/latest/

Ironic

Baremetal Operator

Cluster-api-provider-metal3

Cluster API

Metal³

Node

Machine

GCP

Machine

Baremetal

Operator

Metal3

Machine

AWS

Machine

BareMetalHost

Managing bare metal hosts

Prerequisite: A Kubernetes cluster (the management cluster).

  1. Setup Ironic and BareMetal Operator
  2. Write Kubernetes manifests representing your hardware: BareMetalHosts
  3. Manage your hosts by making changes to the BareMetalHosts in Kubernetes. For example: set boot image, user data, clean disk and inspect hardware details.

Metal³

apiVersion: metal3.io/v1alpha1
kind: BareMetalHost
metadata:
  name: node-0
spec:
  bmc:
    address: ipmi://192.168.111.1:6230
    credentialsName: node-0-bmc-secret
  bootMACAddress: 00:30:22:36:87:8f
  bootMode: legacy
  image:
    checksum: http://172.22.0.1/images/CENTOS_9_NODE_IMAGE_K8S_v1.24.1-raw.img.md5sum
    checksumType: md5
    format: raw
    url: http://172.22.0.1/images/CENTOS_9_NODE_IMAGE_K8S_v1.24.1-raw.img
...

Bare metal Kubernetes clusters

Prerequisite: previous slide

 

  1. Setup Cluster API with the Metal³ provider
  2. Write manifests for CAPM3 resources: Metal3Cluster, IPPool, Metal3MachineTemplate, Metal3DataTemplate
  3. Write/generate manifests for CAPI resources: Cluster, KubeadmControlPlane, MachineDeployment, KubeadmConfigTemplate
  4. Manage both hosts and cluster through the Kubernetes API.

Metal³

Metal³ and Cluster API

Metal³

Cluster

Metal3Cluster

Kubeadm-ControlPlane

M3Machine-Template

Metal3Machine

Machine-Deployment

M3Machine-Template

Metal3Machine

Machine

Machine

BareMetalHost

BareMetalHost

Created by the user

Metal³ and Cluster API

Metal³

Machine-Deployment

M3Machine-Template

Machine

KubeadmConfig-Template

M3Data-Template

KubeadmConfig

Metal3Data

Metal3DataClaim

Metal³

Bootstrap cluster

Minikube

CAPI

CAPM3

BMO

Target cluster

Running in a Metal³ controlled cluster

Move

Metal³

Management cluster

Minikube

CAPI

CAPM3

BMO

Management cluster

Running in a Metal³ controlled cluster

Move

Metal³

Management cluster

Minikube

CAPI

CAPM3

BMO

Management cluster

Running in a Metal³ controlled cluster

Metal³

Metal³ Community 

Contributors:  Red Hat, Ericsson, Mirantis, Dell EMC, Fujitsu, AT&T

#cluster-api-baremetal channel on K8S slack

Community meetings in Zoom. Every Wednesday, @14:00 UTC

Meeting recordings & Demos: Metal³ YouTube channel

Useful links

The Open Source Technology behind CCD

By Lennart Jern

The Open Source Technology behind CCD

Metal³ (“metal kubed”) is an open-source bare metal host provisioning tool created to enable Kubernetes-native infrastructure management. With Metal³ bare metal hosts can be managed via custom resources through the Kubernetes API. The Metal³ project is also building integration with the Kubernetes cluster-api project, allowing Metal³ to be used as an infrastructure backend for Machine objects from the Cluster API.

  • 70