How-To Enable or Disable MetalLB via Sunpike API For an Already Installed Cluster

Problem

How-To Add Enable or Disable MetalLB via Sunpike API For an Already Installed Cluster?

Environment

  • Platform9 Managed Kubernetes - v5.2 and K8s v1.20 and Higher

Procedure

  1. Fetch the authentication TOKEN.

  • Keystone Identity API: This link describes the process for getting a Keystone authentication token in order to access the PMK REST API.

  1. Make use of either the below mentioned API call to check if the cluster already has MetalLB enabled or not.

curl -X GET -H "X-Auth-Token: $TOKEN" https://<DU_FQDN>/qbert/v4/<PROJECT_ID>/sunpike/apis/sunpike.platform9.com/v1alpha2/namespaces/default/clusteraddons/<CLUSTER_UUID>-metallb | jq
  • For the cluster that does not have MetalLB enabled, the below output will be presented.

# curl -k -X GET -H "X-Auth-Token: $TOKEN" https://airctl-1.pf9.localnet/qbert/v4/510ccf9d2b044f8aa28143e58ba47e5f/sunpike/apis/sunpike.platform9.com/v1alpha2/namespaces/default/clusteraddons/5685f4e4-8d34-43d6-8006-8829200bfd3c-metallb | jq
...
...  
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "clusteraddons.sunpike.platform9.com \"5685f4e4-8d34-43d6-8006-8829200bfd3c-metallb\" not found",
  "reason": "NotFound",
  "details": {
    "name": "5685f4e4-8d34-43d6-8006-8829200bfd3c-metallb",
    "group": "sunpike.platform9.com",
    "kind": "clusteraddons"
  },
  "code": 404
}
  1. To enable MetalLB for this cluster create a new JSON spec for MetalLB.

Info

The metallb version in the above JSON file is currently on 0.9.6. It will be updated along with the pf9-kube version and can be referred from the Support Matrix.

  1. To Enable MetalLB ClusterAddon object with the above-mentioned new JSON spec metallbspec.json.

Info

Replace the placeholders: <DU_FQDN>, <PROJECT_ID> and the <CLUSTER_UUID> with their appropriate values wherever required.

The "name" attribute in the spec must be in the format CLUSTER_UUID-metallb

Also,MetallbIpRange value should be set with the required set of IP addresses.

  • The API call mentioned below can be referred as an example for the one above.

  • Verify whether MetalLB is now enabled.

  • To Disable MetalLB for a Cluster that already has it enabled, use the API call below.

  • The API call mentioned below can be referred as an example for the one above.

Last updated