Update docs for deploying Fleet on Kubernetes (#4755)
* feat[WIP]: updating docs for deploying Fleet on Kubernetes * feat: update spec to include environment variables * chore: add fleet image version to yml file * doc: add Kubernetes manifest file Add Kubernetes manifest file to files to be edited for Fleet version change when releasing. * docs: link to the docs on deploying Fleet via K8s * feat: add kubernetes deployment.yml * feat: update Fleet version
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -420,7 +420,75 @@ 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` 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 and connect to its dependencies(MySQL and Redis) 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:4.13.2
|
||||
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"
|
||||
cpu: "250m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "500m"
|
||||
ports:
|
||||
- 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
|
||||
|
||||
`kubectl apply -f ./deployment.yml`
|
||||
|
||||
|
||||
### Installing infrastructure dependencies
|
||||
|
||||
|
||||
Reference in New Issue
Block a user