This document shows deployment process for a FleetDM Helm chart on a local Minikube cluster started on Docker driver.
To deploy the FleetDM Helm chart, the following tools are required:
- Minikube (tested with stable version for Windows)
- Docker Desktop (used as the driver for Minikube)
- Helm 3.18.3
The deployment process uses a Makefile to simplify cluster creation and chart installation.
-
Create the Minikube Cluster: The cluster is created with the Docker driver.
make cluster
-
Install the Helm Chart: Deploy the FleetDM chart, including MySQL and Redis dependencies, to the
flamingonamespace.make install
-
Expose Services with Minikube Tunnel: To make services accessible via
localhost, run Minikube tunnel in the background.make tunnel
-
Access FleetDM: After running the tunnel, FleetDM is available at
http://localhost.
The database migration for FleetDM is executed as a Kubernetes Job. Initially, I considered running fleetdm prepare db as a container within the same pod before starting fleetdm serve.
To confirm that FleetDM and its dependencies (MySQL and Redis) are running correctly, use the following checks:
- Verify connectivity by accessing
http://localhostafter runningmake tunnel. - Note: FleetDM requires MySQL and Redis to be operational to start successfully.
- Check the MySQL server status:
Output:
kubectl exec flamingo-mysql-0 -n flamingo -- mysqladmin -u fleet -pLab123 pingmysqld is alive
- Verify Redis connectivity:
Output:
kubectl exec -it flamingo-redis-master-0 -n flamingo -- redis-cli -a Lab123 PINGPONG
To make the FleetDM Helm chart publicly available, a Helm has been created at https://nikstormov.github.io/flamingo/charts. Further work is needed to learn how to maintain and release updates for the chart, including versioning and documentation.
For CI/CD integration, the proposed workflow includes:
- Updating chart dependencies using
helm dependency update. - Packaging the chart with
helm packageto create a.tgzarchive. - On successful build, pushing the updated chart to the Helm repository.
- Triggering a deployment to test or production environments.
During the setup, I faced issues with MySQL, which were resolved by adjusting the MySQL version.
- Error:
Changed Version to 8.0.24
FAIL 20220915165115_AppleMDMTables.go (failed to apply nanomdm schema: Error 6125: Failed to add the foreign key constraint. Missing unique key for constraint 'nano_enrollments_ibfk_2' in the referenced table 'nano_users'), quitting migration.mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists! - Cause: The issue was caused by an incompatible MySQL version.
- Resolution: Use propriate verison taken from git