Skip to content

Install

What Will You Do

In this exercise,

  • You will create a MetalLB addon and use it in a custom cluster blueprint
  • You will then apply this cluster blueprint to a managed cluster

Important

This tutorial describes the steps to create and use a custom cluster blueprint using the Web Console. The entire workflow can also be fully automated and embedded into an automation pipeline.


Assumptions

  • You have already provisioned an upstream Kubernetes cluster (bare metal or VM based)
  • You have an allocated range of IP Addresses to be used for load-balancers.

Step 1: Download MetalLB YAML Manifest

Download the following YAML manifest metallb.yaml.

Note

We are using v0.9.5 of MetalLB in this recipe and should also apply to updated versions


Step 2: Create ConfigMap YAML

  • Create the file "metallb-configmap.yaml" and copy the contents below. Edit the address space to match the address space you have assigned to your load-balancers.
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 10.0.2.240-10.0.2.250

Step 3: Create Secret Yaml

  • Run the following command on a Unix system and replace "AddSecretHere" in the following step with the returned value
openssl rand -base64 128 | base64

WEJaaVdwWEdjMUYyRmFDWVMzM2dsdXdFM1ZhVzZQQmdGbVV5RDhWeEhJbGVTWUFDZGIyOUVIVkhrWFVqV3N0bQpJL0NGMEp5YmV5QzJUUmFmR2ZNRzFtc2VOWFNIUm5kcEtuRkFuNnVqZXlmZkZXYWZFc004UG5pWlE4SnBnemdYCmFHQ1k4RlRrY0VpK0pBQVFBcndGOXd2cFhmdUhDa0YzSmwrR2taemtvaGc9Cg==
  • Create the file "metallb-secret.yaml" and copy the secret created above.
apiVersion: v1
data:
  secretkey: AddSecretHere
kind: Secret
metadata:
  name: memberlist
  namespace: metallb-system
type: Opaque

Step 4: Create MetalLB Addons

  • Under Infrastructure, select "Namespaces" and create a new namespace called "metallb-system"
  • Select "Addons" and "Create" a new Addon called "metallb-controller" by selecting the "+ New Add-On" button
  • Ensure that you select "k8s YAML" for type and select the namespace as "metallb-system"
  • Provide the "metallb.yaml" from the previous step and select "CREATE"
  • Click on "+ New Version"
  • Enter "v0.9.5" for the Version Name and "UPLOAD" the k8s Yaml File downloaded in step 1
  • Select "Save Changes"

Create MetalLB Addon

  • Select "Addons" and "Create" a new Addon called "metallb-configmap" by selecting the "+ New Add-On" button
  • Ensure that you select "k8s YAML" for type and select the namespace as "metallb-system"
  • Provide the "metallb-configmap.yaml" from step 2 and select "CREATE"
  • Click on "+ New Version"
  • Enter "v1.0" for the Version Name and "UPLOAD" the k8s Yaml File created in step 2
  • Select "Save Changes"

Create MetalLB CM Addon

  • Select "Addons" and "Create" a new Addon called "metallb-secret" by selecting the "+ New Add-On" button
  • Ensure that you select "k8s YAML" for type and select the namespace as "metallb-system"
  • Provide the "metallb-secret.yaml" from step 3 and select "CREATE"
  • Click on "+ New Version"
  • Enter "v1.0" for the Version Name and "UPLOAD" the k8s Yaml File cretaed in step 3
  • Select "Save Changes"

Create MetalLB Secret Addon


Step 5: Create Blueprint

Now, we are ready to assemble a custom cluster blueprint using the addons.

  • Under Infrastructure, select "Blueprints"
  • Create a new blueprint and give it a name such as "metallb"
  • Create a new version of the blueprint by selecting "+ New Version"
  • Enter a version name such as "1.0" and add the metallb-controller, metallb-configmap, and metallb-secret addons.

Once the blueprint is created, ensure you publish it and optionally provide a version so that it can be tracked.

Create Blueprint

Show Blueprint


Step 6: Apply Blueprint

Now, we are ready to apply this custom blueprint to a cluster.

  • Click on Options for the target Cluster in the Web Console
  • Select "Update Blueprint" and select the "metallb" blueprint and appropriate version we created from the list

Update Blueprint

Click on "Save and Publish". This will start the deployment of the addons configured in the "metallb" blueprint to the targeted cluster. The blueprint sync process can take a few minutes. Once complete, the cluster will display the current cluster blueprint details and whether the sync was successful or not. See illustrative example below.

Blueprint Update


Step 7: Verify Deployment

Users can optionally verify whether the correct resources have been created on the cluster.

  • Click on the Kubectl button on the cluster to open a virtual terminal
  • We will verify the pods in the "metallb-system" namespace. You should see something like the example below.
kubectl get pod -n metallb-system

NAME                          READY   STATUS    RESTARTS   AGE
controller-7b44f76996-glj6w   1/1     Running   0          71m
speaker-vnbnc                 1/1     Running   0          71m

Recap

Congratulations! You have successfully created a custom cluster blueprint with the "metallb" addon and applied to a cluster. You can now use this blueprint on as many clusters as you require.