Managed Kubernetes
Latest
Frequently Asked Questions
Solutions
How Tos
Internal Only
Templates
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
How-To Enable or Disable MetalLB via Sunpike API For an Already Installed Cluster
Copy Markdown
Open in ChatGPT
Open in Claude
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
- 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.
- Make use of either the below mentioned API call to check if the cluster already has MetalLB enabled or not.
Command
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.
Example
# 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}- To enable MetalLB for this cluster create a new JSON spec for MetalLB.
Reference Format for MetalLB Spec JSON
xxxxxxxxxx# cat metallb.json{"apiVersion": "sunpike.platform9.com/v1alpha2","kind": "ClusterAddon","metadata": { "labels": { "sunpike.pf9.io/cluster": "CLUSTER_UUID", "type": "metallb" }, "name": "CLUSTER_UUID-metallb", "namespace": "default"},"spec": { "clusterID": "CLUSTER_UUID", "override": { "params": [ { "name": "MetallbIpRange", "value": "10.128.147.250-10.128.147.251" } ] }, "type": "metallb", "version": "0.9.6", "watch": false}}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.
- To Enable MetalLB ClusterAddon object with the above-mentioned new JSON spec metallbspec.json.
API call to enable the MetalLB
# curl -X POST -H "X-Auth-Token: $TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -d "@metallb.json" $DU_FQDN/qbert/v4/$PROJECT_ID/sunpike/apis/sunpike.platform9.com/v1alpha2/namespaces/default/clusteraddonsReplace 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.
API call Example to enable the MetalLB
# curl -X POST -H "X-Auth-Token: $TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -d "@metallb.json" https://airctl-1.pf9.localnet/qbert/v4/510ccf9d2b044f8aa28143e58ba47e5f/sunpike/apis/sunpike.platform9.com/v1alpha2/namespaces/default/clusteraddons- Verify whether MetalLB is now enabled.
Example
x
# 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": "ClusterAddon", "apiVersion": "sunpike.platform9.com/v1alpha2", "metadata": { ... "spec": { "clusterID": "5685f4e4-8d34-43d6-8006-8829200bfd3c", "version": "0.9.6", "type": "metallb", "override": { "params": [ { "name": "MetallbIpRange", "value": "10.128.147.250-10.128.147.251" } ] }, "watch": true }, "status": { "phase": "Installed", "lastChecked": null }} # kubectl get clusteraddons --kubeconfig='/etc/sunpike/kubeconfig'NAME CLUSTER TYPE PHASE CREATED AT5685f4e4-8d34-43d6-8006-8829200bfd3c-coredns 5685f4e4-8d34-43d6-8006-8829200bfd3c coredns Installed 2021-11-18T06:11:37Z5685f4e4-8d34-43d6-8006-8829200bfd3c-kubernetes-dashboard 5685f4e4-8d34-43d6-8006-8829200bfd3c kubernetes-dashboard Installed 2021-11-18T06:11:37Z5685f4e4-8d34-43d6-8006-8829200bfd3c-metrics-server 5685f4e4-8d34-43d6-8006-8829200bfd3c metrics-server Installed 2021-11-18T06:11:37Z5685f4e4-8d34-43d6-8006-8829200bfd3c-metallb 5685f4e4-8d34-43d6-8006-8829200bfd3c metallb Installed 2021-11-18T10:37:47Z- To Disable MetalLB for a Cluster that already has it enabled, use the API call below.
API call to disable MetalLB
# curl -X DELETE -H "X-Auth-Token: $TOKEN" $DU_FQDN/qbert/v4/$PROJECT_ID/sunpike/apis/sunpike.platform9.com/v1alpha2/namespaces/default/clusteraddons/<CLUSTER_UUID>-metallb- The API call mentioned below can be referred as an example for the one above.
API Call Example for disabling metalLB
# curl -X DELETE -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-metallbVariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
Last updated on
Was this page helpful?
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message