Skip to content

The PhoenixNAP BMC provider implementation of the Cluster Management API

License

Notifications You must be signed in to change notification settings

phoenixnap/cluster-api-provider-bmc

Repository files navigation


phoenixnap Bare Metal Cloud
Bare Metal Cloud API Provider for Kubernetes

The Bare Metal Cloud API Provider for Kubernetes allows developers to define, deploy, and manage Bare Metal Cloud servers to provision, upgrade and operate Kubernetes clusters.

Bare Metal CloudDevelopers PortalAPI DocumentationKnowledge BaseSupport

Creating a Bare Metal Cloud Account

You need to have a Bare Metal Cloud account to use this Kubernetes Cluster API.

  1. Go to the Bare Metal Cloud signup page.
  2. Follow the prompts to set up your account.
  3. Use your credentials to log in to the Bare Metal Cloud portal.

▶️ Video tutorial: How to Create a Bare Metal Cloud Account
▶️ Video tutorial: Introduction to Bare Metal Cloud

Getting Started from Source

  1. Install and/or configure Kubernetes cluster (1.23+). Cluster API requires an existing Kubernetes cluster accessible via kubectl.

  2. Install clusterctl

  3. Download clusterctl.yaml file

  4. Initialize BMC clusterctl management cluster. See Avoiding GitHub rate limiting if you're experiencing errors from GitHub.

    export BMC_CLIENT_ID=<bmc client id>
    export BMC_CLIENT_SECRET=<bmc client secret>
    
    # Initialize the management cluster
    clusterctl init --infrastructure bmc --config clusterctl.yaml
    
  5. Generate the cluster configuration. This creates a files called capi-quickstart.yaml with predefined list of Cluster API objects.

    export BMC_CONTROL_PLANE_MACHINE_TYPE=s2.c1.medium  # server type of the control plane
    export BMC_LOCATION=PHX                             # location of cluster
    export BMC_NODE_TYPE=s2.c1.medium                   # server types of the node
    
    # Optional variables
    export CNI_VERSION=1.1.1        # version number for Container Network Interface (https://github.com/containernetworking/cni)
    export CONTAINERD_VERSION=1.4.4 # version number for Containerd (https://github.com/containerd/containerd)
    export CRI_VERSION=1.25.0       # version number for Kubernetes Container Runtime Interface (https://github.com/kubernetes-sigs/cri-tools/)
    export RUNC_VERSION=1.1.4       # version number for runc (https://github.com/opencontainers/runc)
    
    # Generate the cluster configuration
    clusterctl generate cluster capi-quickstart \
      --kubernetes-version 1.25.0 \
      --worker-machine-count=3 \
      > capi-quickstart.yaml
    
  6. Apply the cluster configuration kubectl apply -f capi-quickstart.yaml

  7. Access the workload cluster.

    # The cluster will now start provisioning. You can check status with:
    kubectl get cluster
    
    # You can also get an “at glance” view of the cluster and its resources by running:
    clusterctl describe cluster capi-quickstart
    
    # To verify the first control plane is up:
    kubectl get kubeadmcontrolplane
    
  8. Once the control plane is initialized, you can retrieve the workload cluster Kubeconfig.

    # Control plane initialized
    kubectl get kubeadmcontrolplane
    
    NAME                    CLUSTER           INITIALIZED   API SERVER AVAILABLE   REPLICAS   READY   UPDATED   UNAVAILABLE   AGE    VERSION
    capi-quickstart-g2trk   capi-quickstart   true                                 1                  1         1             4m7s   v1.25.0
    
    # Workload cluster Kubeconfig
    clusterctl get kubeconfig capi-quickstart > capi-quickstart.kubeconfig
    
  9. Deploy a CNI solution (control plane won't be Ready till a CNI is installed)

    # Ex. deploying calico
    kubectl --kubeconfig=./capi-quickstart.kubeconfig \
      apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.1/manifests/calico.yaml
    
    
  10. Verify nodes are in a Ready status.

    kubectl --kubeconfig=./capi-quickstart.kubeconfig get nodes
    
    NAME                                          STATUS   ROLES           AGE   VERSION
    capi-quickstart-g2trk-9xrjv                   Ready    control-plane   12m   v1.25.0
    capi-quickstart-md-0-55x6t-5649968bd7-8tq9v   Ready    <none>          12m   v1.25.0
    capi-quickstart-md-0-55x6t-5649968bd7-glnjd   Ready    <none>          12m   v1.25.0
    capi-quickstart-md-0-55x6t-5649968bd7-sfzp6   Ready    <none>          12m   v1.25.0
    
  11. Clean up workload cluster

    kubectl delete cluster capi-quickstart
    

Pulling the Image

The Bare Metal Cloud Cluster API is available as a Docker image here.

Testing and CI

  1. Create a GitHub annotated tag
    • export RELEASE_TAG=<the tag of the release to be cut> (eg. export RELEASE_TAG=v1.0.1)
    • git tag -a ${RELEASE_TAG} -m ${RELEASE_TAG}
    • git tag test/${RELEASE_TAG} (:warning: MUST NOT be an annotated tag)
  2. Push the tag to the GitHub repository. This will automatically trigger a Github Action to create a draft release.

    NOTE: origin should be the name of the remote pointing to github.com/phoenixnap/cluster-api-provider-bmc

    • git push origin ${RELEASE_TAG}
    • git push origin test/${RELEASE_TAG}
  3. Images are built by a Github Action. This pushes the image to the GitHub Packages
  4. Review the draft release on GitHub.
  5. Publish the release

Retrieving BMC Credentials

  1. Log in to the Bare Metal Cloud portal.
  2. On the left side menu, click on API Credentials.
  3. Click the Create Credentials button.
  4. Fill in the Name and Description fields, select the permissions scope and click Create.
  5. In the table, click on Actions and select View Credentials from the dropdown.

💡 Tutorial: How to create and manage BMC credentials

Note to Maintainers

Be careful moving this repository. This project is written in Go and as such uses Git repo URLs as package identifiers. If the code URL is changed the code will need to be changed appropriately.

This is a kubebuilder project. Only minimal changes have been made to this codebase from the generated scaffolding so that maintainers can leverage as much off-the-shelf tooling and documentation as possible from the kubebuilder project. The bulk of the application code lives in the machine and cluster controller files,controllers/bmcmachine_controller.go and controllers/bmccluster_controller.go. The API type definitions, defaulting and validating webhook logic live in the directory, api/v1beta1.

Bare Metal Cloud Community

Become part of the Bare Metal Cloud community to get updates on new features, help us improve the platform, and engage with developers and other users.

Bare Metal Cloud Resources

Documentation

Contact phoenixNAP

Get in touch with us if you have questions or need help with Bare Metal Cloud.

TwitterFacebookLinkedInInstagramYouTubeEmail


phoenixnap Bare Metal Cloud