Installing StackLight#
Prerequisites#
Before installing Stacklight, make sure to satisfy these prerequisites:
- A k0s cluster: The cluster should have at least 1 worker node for non-HA installations, and a minimum of 3 worker nodes for an HA StackLight installation.
- Metrics scraping: Deploy k0s with the
--enable-metrics-scraperfeature (as described here. - A configured
StorageClassin the cluster: StackLight requires persistent volumes for its components. For Mirantis k0rdent Virtualization (KubeVirt), StackLight uses thekubernetes-hddStorageClasscreated by Ceph. - An external load balancer provider: If you want StackLight's component UIs to be exposed externally, make sure the cluster has this external load balancer provider configured.
- Kernel count: The node(s) where StackLight pods will be running should have a
vm.max_map_countkernel parameter of 262144 or higher. You can also setopensearch.editMaxMapCount=truein your StackLight object spec (see API Documentation). This causesopensearch init containerto setvm.max_map_count=262144. - Node roles: Only nodes marked as
role=controller+workerandrole=workerare monitored by StackLight, as StackLight monitoring agents are running as k8s workloads in the cluster. Make sure all nodes you want monitored are marked accordingly.
Installation Procedure#
StackLight has components on both the management and child clusters.
On the Mirantis k0rdent Enterprise management cluster#
Follow these steps to install Stacklight on the management cluster:
-
Create a
HelmRepositoryobject in your KCM cluster. Create a YAML file calledstacklight-helm-repo.yaml:apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmRepository metadata: labels: k0rdent.mirantis.com/managed: "true" name: stacklight namespace: kcm-system spec: interval: 10m0s url: https://binary.mirantis.com/stacklight/helm/ -
Apply the YAML to the management cluster:
kubectl apply -f stacklight-helm-repo.yaml -n kcm-systemHelmRepository object created. -
Verify the object is created and ready:
kubectl get helmrepo stacklight -n kcm-systemNAME URL AGE READY STATUS stacklight https://binary.mirantis.com/stacklight/helm/ 12d True stored artifact: revision 'sha256:1f5fa3f4adbfeffa6ffb929ee4488341f473b3795d9a16da0e5170450631cce4' -
Create a
ServiceTemplateobject by starting with a YAML file calledstacklight-operator-template.yaml:apiVersion: k0rdent.mirantis.com/v1beta1 kind: ServiceTemplate metadata: name: stacklight-operator-0-1-0 namespace: kcm-system spec: helm: chartSpec: chart: stacklight-operator interval: 10m0s reconcileStrategy: ChartVersion sourceRef: kind: HelmRepository name: stacklight version: 0.1.0-mcp-16 -
Add the YAML to the cluster:
kubectl apply -f stacklight-operator-template.yaml -n kcm-systemServiceTemplate object created. -
Verify the object is created and valid:
kubectl get servicetemplate stacklight-operator-0-1-0 -n kcm-systemNAME VALID stacklight-operator-0-1-0 true -
Finally, add the
stacklight-operatorServiceto the.spec.serviceSpec.serviceslist of the targetedClusterDeploymentobject. You can do this on the initialClusterDeploymentcreation or by modifying the existingClusterDeploymentobject, as in:apiVersion: k0rdent.mirantis.com/v1beta1 kind: ClusterDeployment ... spec: serviceSpec: services: ... - name: stacklight-operator namespace: stacklight-system template: stacklight-operator-0-1-0 ...
On the targeted KCM Mirantis k0rdent Virtualization managed child cluster#
Once you've installed StackLight into the management cluster, you need to install it on the child cluster you want to monitor. Follow these steps, making sure KUBECONFIG points to the proper cluster:
-
Create a separate StackLight namespace:
kubectl create ns stacklight -
Create a
StackLightobject and configure it according to your needs. Check the available configuration options (see the API Documentation). For example, create a YAML file calledminimal-stacklight.yamlwith a minimal required configuration:apiVersion: monitoring.mirantis.com/v1alpha1 kind: StackLight metadata: name: stacklight namespace: stacklight spec: exposeLoadBalancers: true highAvailabilityEnabled: true kubernetes: distribution: k0s kubevirtMonitoringEnabled: true opensearch: editMaxMapCount: true persistentVolumeClaimSize: 50Gi prometheus: persistentVolumeClaimSize: 50Gi retentionSize: 45GB retentionTime: 30d storageClassName: kubernetes-hddNote
You must set
kubevirtMonitoringEnabled=trueto enable installation of Mirantis k0rdent Virtualization monitoring-related components. -
Finally, add the
StackLightYAML to the cluster:kubectl apply -f minimal-stacklight.yaml -n stacklightStackLight object created.