From 60c2a3ed09bc993ebe1e729fe7708c49d383e758 Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Wed, 23 Mar 2022 05:48:10 +0100 Subject: [PATCH 1/7] feat[WIP]: updating docs for deploying Fleet on Kubernetes --- docs/Deploying/Server-Installation.md | 45 +++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/Deploying/Server-Installation.md b/docs/Deploying/Server-Installation.md index 4aacecf2893..6b6e04118a5 100644 --- a/docs/Deploying/Server-Installation.md +++ b/docs/Deploying/Server-Installation.md @@ -420,7 +420,48 @@ If you go back to [https://localhost:8080/hosts/manage](https://localhost:8080/h ## Deploying Fleet on Kubernetes -In this guide, we're going to install Fleet and all of its application dependencies on a Kubernetes cluster. Kubernetes is a container orchestration tool that was open sourced by Google in 2014. +In this guide, we're going to focus on deploying Fleet only on a Kubernetes cluster. Kubernetes is a container orchestration tool that was open sourced by Google in 2014. + +We will assume you have `kubectl` all set up and optionally you have minikube to test your deployment locally on your machine. + +To deploy the Fleet server we will set up a `deployment.yml` file with the following specifications: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fleet-deployment + labels: + app: fleet +spec: + replicas: 3 + selector: + matchLabels: + app: fleet + template: + metadata: + labels: + app: fleet + spec: + containers: + - name: fleet + image: fleetdm/fleet + resources: + requests: + memory: "64Mi" + cpu: "250m" + limits: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 3000 + +``` + +Let's tell Kubernetes to create the cluster by running the below command + +`kubectl apply -f ./deployment.yml` + ### Installing infrastructure dependencies @@ -601,4 +642,4 @@ Below are some projects created by Fleet community members. These projects provi - [CptOfEvilMinions/FleetDM-Automation](https://github.com/CptOfEvilMinions/FleetDM-Automation) - Ansible and Docker code to set up Fleet - \ No newline at end of file + From 15ba1626b0def896d72a50f0535a9606b2860987 Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Tue, 29 Mar 2022 13:31:18 +0100 Subject: [PATCH 2/7] feat: update spec to include environment variables --- docs/Deploying/Server-Installation.md | 31 +++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/docs/Deploying/Server-Installation.md b/docs/Deploying/Server-Installation.md index 6b6e04118a5..d50f36b6fac 100644 --- a/docs/Deploying/Server-Installation.md +++ b/docs/Deploying/Server-Installation.md @@ -422,9 +422,9 @@ If you go back to [https://localhost:8080/hosts/manage](https://localhost:8080/h In this guide, we're going to focus on deploying Fleet only on a Kubernetes cluster. Kubernetes is a container orchestration tool that was open sourced by Google in 2014. -We will assume you have `kubectl` all set up and optionally you have minikube to test your deployment locally on your machine. +We will assume you have `kubectl` and MySQL and Redis are all set up and running. Optionally you have minikube to test your deployment locally on your machine. -To deploy the Fleet server we will set up a `deployment.yml` file with the following specifications: +To deploy the Fleet server and connect to its dependencies(MySQL and Redis) we will set up a `deployment.yml` file with the following specifications: ```yaml apiVersion: apps/v1 @@ -446,6 +446,32 @@ spec: containers: - name: fleet image: fleetdm/fleet + env: + - name: FLEET_MYSQL_ADDRESS + valueFrom: + secretKeyRef: + name: fleet_secrets + key: mysql_address + - name: FLEET_MYSQL_DATABASE + valueFrom: + secretKeyRef: + name: fleet_secrets + key: mysql_database + - name: FLEET_MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: fleet_secrets + key: mysql_password + - name: FLEET_MYSQL_USERNAME + valueFrom: + secretKeyRef: + name: fleet_secrets + key: mysql_username + - name: FLEET_REDIS_ADDRESS + valueFrom: + secretKeyRef: + name: fleet_secrets + key: redis_address resources: requests: memory: "64Mi" @@ -457,6 +483,7 @@ spec: - containerPort: 3000 ``` +Notice we are using secrets to pass in values for Fleet's dependencies' environment variables. Let's tell Kubernetes to create the cluster by running the below command From ffbd2f66c956059c1349c8f18939d4dd98ce19dc Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Thu, 31 Mar 2022 13:57:47 +0100 Subject: [PATCH 3/7] chore: add fleet image version to yml file --- docs/Deploying/Server-Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Deploying/Server-Installation.md b/docs/Deploying/Server-Installation.md index d50f36b6fac..da3add8da0d 100644 --- a/docs/Deploying/Server-Installation.md +++ b/docs/Deploying/Server-Installation.md @@ -445,7 +445,7 @@ spec: spec: containers: - name: fleet - image: fleetdm/fleet + image: fleetdm/fleet:4.12.0 env: - name: FLEET_MYSQL_ADDRESS valueFrom: From 16763855d08bfe20c12762fe118492d34b49479c Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Wed, 13 Apr 2022 18:25:57 +0100 Subject: [PATCH 4/7] doc: add Kubernetes manifest file Add Kubernetes manifest file to files to be edited for Fleet version change when releasing. --- docs/Contributing/Releasing-Fleet.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Contributing/Releasing-Fleet.md b/docs/Contributing/Releasing-Fleet.md index 0f3482e1eb2..ee74308ea06 100644 --- a/docs/Contributing/Releasing-Fleet.md +++ b/docs/Contributing/Releasing-Fleet.md @@ -17,6 +17,7 @@ Note: Please prefix versions with `fleet-v` (eg. `fleet-v4.0.0`) in git tags, He - [package.json](https://github.com/fleetdm/fleet/blob/main/tools/fleetctl-npm/package.json) (do not yet `npm publish`) - [Helm chart](https://github.com/fleetdm/fleet/blob/main/charts/fleet/Chart.yaml) and [values file](https://github.com/fleetdm/fleet/blob/main/charts/fleet/values.yaml) - [Terraform variables](https://github.com/fleetdm/fleet/blob/main/infrastructure/dogfood/terraform/aws/variables.tf) + - Kubernetes manifest file Commit these changes via Pull Request and pull the changes on the `main` branch locally. Check that `HEAD` of the `main` branch points to the commit with these changes. From f5b3236e2645e9ac743213a801bce550b0575f85 Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Wed, 13 Apr 2022 18:39:01 +0100 Subject: [PATCH 5/7] docs: link to the docs on deploying Fleet via K8s --- docs/Contributing/Releasing-Fleet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Contributing/Releasing-Fleet.md b/docs/Contributing/Releasing-Fleet.md index ee74308ea06..a491bba8a09 100644 --- a/docs/Contributing/Releasing-Fleet.md +++ b/docs/Contributing/Releasing-Fleet.md @@ -17,7 +17,7 @@ Note: Please prefix versions with `fleet-v` (eg. `fleet-v4.0.0`) in git tags, He - [package.json](https://github.com/fleetdm/fleet/blob/main/tools/fleetctl-npm/package.json) (do not yet `npm publish`) - [Helm chart](https://github.com/fleetdm/fleet/blob/main/charts/fleet/Chart.yaml) and [values file](https://github.com/fleetdm/fleet/blob/main/charts/fleet/values.yaml) - [Terraform variables](https://github.com/fleetdm/fleet/blob/main/infrastructure/dogfood/terraform/aws/variables.tf) - - Kubernetes manifest file + - [Kubernetes manifest file](https://fleetdm.com/docs/deploying/server-installation#deploying-fleet-on-kubernetes) Commit these changes via Pull Request and pull the changes on the `main` branch locally. Check that `HEAD` of the `main` branch points to the commit with these changes. From 9579326c32aa19d4820382262f514ab4f9cc0e93 Mon Sep 17 00:00:00 2001 From: Kelvin Omereshone Date: Fri, 6 May 2022 13:51:19 +0100 Subject: [PATCH 6/7] feat: add kubernetes deployment.yml --- docs/Contributing/Releasing-Fleet.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Contributing/Releasing-Fleet.md b/docs/Contributing/Releasing-Fleet.md index 62375709693..5b97f604c5c 100644 --- a/docs/Contributing/Releasing-Fleet.md +++ b/docs/Contributing/Releasing-Fleet.md @@ -17,6 +17,7 @@ Note: Please prefix versions with `fleet-v` (eg. `fleet-v4.0.0`) in git tags, He - [fleetctl package.json](https://github.com/fleetdm/fleet/blob/main/tools/fleetctl-npm/package.json) (do not yet `npm publish`) - [Helm chart.yaml](https://github.com/fleetdm/fleet/blob/main/charts/fleet/Chart.yaml) and [values file](https://github.com/fleetdm/fleet/blob/main/charts/fleet/values.yaml) - Terraform variables ([AWS](https://github.com/fleetdm/fleet/blob/main/infrastructure/dogfood/terraform/aws/variables.tf)/[GCP](https://github.com/fleetdm/fleet/blob/main/infrastructure/dogfood/terraform/gcp/variables.tf)) + - [Kubernetes `deployment.yml` example file](https://github.com/fleetdm/fleet/blob/main/docs/Deploying/Server-Installation.md#deploying-fleet-on-kubernetes) Commit these changes via Pull Request and pull the changes on the `main` branch locally. Check that `HEAD` of the `main` branch points to the commit with these changes. From c24073cb20c012deabb7e44e36669dbe816a6d23 Mon Sep 17 00:00:00 2001 From: Kelvin Omereshone Date: Fri, 6 May 2022 13:53:41 +0100 Subject: [PATCH 7/7] feat: update Fleet version --- docs/Deploying/Server-Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Deploying/Server-Installation.md b/docs/Deploying/Server-Installation.md index 275ed59801f..c759b4324a6 100644 --- a/docs/Deploying/Server-Installation.md +++ b/docs/Deploying/Server-Installation.md @@ -445,7 +445,7 @@ spec: spec: containers: - name: fleet - image: fleetdm/fleet:4.12.0 + image: fleetdm/fleet:4.13.2 env: - name: FLEET_MYSQL_ADDRESS valueFrom: