Skip to content

Add article: How to run Fleet GitOps at enterprise scale - #59901

Draft
kitzy wants to merge 3 commits into
mainfrom
kitzy/article-gitops-enterprise-scale
Draft

kitzy wants to merge 3 commits into
mainfrom
kitzy/article-gitops-enterprise-scale

Conversation

@kitzy

@kitzy kitzy commented Nov 25, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves fleetdm/confidential#16344

New article (category: articles) on running Fleet GitOps across many teams and fleets:

  • Repo layout: one repo, a file per fleet, shared platform folders (Fleet's own it-and-security repo as the example)
  • Which repo owns what, including the gotcha that the fleetctl new workflow passes --delete-other-fleets by default when default.yml is present
  • CODEOWNERS per fleet, per platform, and security-owned policies
  • Branch protection settings (required reviews, code owner review, stale approval dismissal, no force pushes or bypass)
  • Making the fleetctl gitops --dry-run check a required status check
  • Least-privilege gitops role tokens, GitOps mode, and a link to Set up Fleet GitOps for staging and production

Fleet claims were verified against the repo (cmd/fleetctl/fleetctl/templates/new/, cmd/fleetctl/fleetctl/gitops.go, server/fleet/teams.go, docs/Configuration/yaml-files.md, CODEOWNERS).

To check before publishing:

  • publishedOn is set to 2026-11-25; update it to the real publish date.
  • The GitLab details (code owner approvals require GitLab Premium or Ultimate, and the Pipelines must succeed merge check name) weren't verifiable in this repo.

Checklist for submitter

Testing

  • QA'd all new/changed functionality manually

AI

AI: Claude Code (claude-opus-5-5)

Frontend

  • Attached a screenshot or screen recording of each user-visible change. For changes to existing UI, show the before and after.

Covers repo layout, repo ownership and --delete-other-fleets, CODEOWNERS,
branch protection, required dry runs, and least-privilege GitOps tokens for
enterprises running Fleet GitOps across many teams.

Co-Authored-By: Claude <noreply@anthropic.com>
@kitzy

kitzy commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

@jakestenger @jp-cpe @AdamBaali I'd love for all of you to give this a once over and give me any feedback.

Correct minor grammatical errors and improve clarity in the document.
@AdamBaali

Copy link
Copy Markdown
Member

Thanks @kitzy, this is a great piece. I checked the Fleet-specific claims against main (templates/new/, gitops.sh, server/fleet/teams.go, and yaml-files.md). These are all accurate: the --delete-other-fleets behavior, the fleet-gitops job name, the global gitops role on Fleet Free, GitOps mode requiring Fleet Premium, and the concurrency and resource_group details.

Open questions from the PR description

  • The GitLab details are correct. Code Owners requires GitLab Premium or Ultimate, and so do required approval rules. On GitLab Free, you can't require any approvals, which is worth saying plainly. Pipelines must succeed is the right name. It's under Settings > Merge requests > Merge checks (API: only_allow_merge_if_pipeline_succeeds). Two things to know: it blocks a merge when no pipeline exists, and a skipped pipeline also blocks unless Skipped pipelines are considered successful is on. The generated .gitlab-ci.yml runs on merge_request_event, so it works with this setting as is.

Accuracy

  1. "A dry run catches everything else" promises too much. A dry run confirms that Fleet will accept the YAML. It doesn't confirm intent, like a file on the wrong fleet, or a shared file whose change reaches fleets whose owners never reviewed it. It also skips any profile that contains $FLEET_SECRET_, and some failures only appear on the device. Consider "catches most mechanical mistakes", with a pointer to the guardrails that follow.
  2. Concurrency at scale. The generated GitHub workflow uses one concurrency group (${{ github.workflow }}, cancel-in-progress: false) for both pull request dry runs and applies to main. GitHub keeps only one pending run per group, so in a busy repo a newer run cancels a queued dry run. A required check that shows as canceled blocks the merge until someone reruns it. Consider recommending one group for applies and a per-branch group for dry runs.
  3. "Require branches to be up to date" means a lot of rebasing when several teams merge every day. Consider mentioning merge queues as the option for larger teams. The generated workflow needs a merge_group trigger for the required check to report in a merge queue.
  4. Nightly drift correction. The generated GitHub workflow has a nightly schedule. The GitLab template has a schedule rule, but nothing runs until someone creates a pipeline schedule. Also, recommend alerting on failed nightly runs. The action installs the fleetctl version that matches the Fleet server, so a Fleet upgrade can reject configuration that was valid the day before. For example, since Fleet 4.94 (Validate label name and description length before apply #54853), fleetctl gitops (including --dry-run) fails when a label name or description is longer than 255 characters. Repos that applied cleanly before the upgrade started failing with no changes, including Fleet's own dogfood repo (Shorten two dogfood label descriptions to fit the 255-character limit #55216). The upgrade note is in Call out 4.94 GitOps label length limit in release notes and docs #57379.
  5. Least privilege. Instead of "then assign the role in Fleet," consider showing the command fleetctl new already prints:
    fleetctl user create --name GitOps --email gitops@example.com --password <password> --global-role gitops --api-only
  6. GitOps mode exceptions. Consider mentioning that exceptions for labels, software, and enroll secrets are set in the UI (Settings > Integrations > Change management), not in YAML. Multi-team organizations often need them.
  7. Terminology. Fleet renamed teams to fleets, so a sentence early on would help: "team" in this article means a group of people, and "fleet" means a group of hosts. Readers who know older versions of Fleet will otherwise mix them up.
  8. Repo layout. fleetctl new generates workstations and personal-mobile-devices fleets. It also generates platforms/all/ for cross-platform policies and reports, and AGENTS.md, CLAUDE.md, and .agents/skills/fleet-gitops/ for AI coding assistants. Consider adding these to the tree. The /platforms/*/policies/ CODEOWNERS rule already covers platforms/all/policies/.

Lessons from customer repos

  • Shared folders and CODEOWNERS can encourage copying. If one team owns platforms/macos/ and another owns a fleet file, the easiest path is to copy a shared profile into a folder the second team owns. That creates a silent fork: when someone fixes the original, the copy keeps the old behavior. One customer had a fix to a shared profile undone on 8 fleets for about a month, because the new fleets were created from a copy made before the fix. A "reference, don't copy" rule would have caught this on day one, backed by a CI check for duplicate PayloadIdentifier values across folders.
  • "Fix it once and every fleet picks it up" cuts both ways. The team that owns a shared folder can change every fleet that references it, without review from the teams that own those fleets. Pair this with the test fleet canary, or with a CI step that lists which fleet files reference the changed files.
  • Globs are all or nothing. Every option on a paths: entry (labels, self_service, and so on) applies to every file it matches. When a team needs to scope individual files with labels, those files need their own path: entries. Mutually exclusive variants belong in a folder that no glob matches. Otherwise, a variant added to a globbed folder ships to every host.
  • Fleet files drift. New fleets usually start as copies of an existing fleet and slowly change over time, in self-service categories, setup experience settings, and so on. Some customers pick one fleet as the reference and have CI compare the others against it. Any intentional difference goes in an exceptions file with a reason.
  • Add checks specific to your organization. Beyond the dry run, CI can enforce the rules only your organization knows. Examples include one business unit's branded software on another unit's fleet (valid YAML that the dry run accepts), two teams' profiles sharing an identifier, and broken path references. The validate.py script that fleetctl new includes is a good starting point.
  • Naming conventions matter more with more teams. If two teams ship profiles with the same PayloadIdentifier, one overwrites the other on the host. A naming convention that puts the owner or scope in the identifier prevents this.
  • Manual labels shared between the UI and GitOps. For a manual label whose hosts are managed in the UI, leave out the hosts key entirely. Setting hosts: [] removes every host added in the UI on each GitOps run. This often catches teams where one group manages pilot hosts in the UI and another group owns the YAML.
  • GitOps is for configuration, not device actions. Locking, wiping, running a one-off script, and other help desk actions should stay in the UI and API, controlled by user roles. A support engineer shouldn't have to wait for a pull request and CI to lock a lost laptop. A sentence in "Make the repo the only way in" would prevent readers from concluding that GitOps mode moves everything into Git.
  • A real CODEOWNERS use case. Some customers need a desktop or network engineering team to approve specific profiles, like Wi-Fi, 802.1X, or certificates, before they ship. A CODEOWNERS line per profile handles this. Fleet signs profiles at delivery, so the profile reviewed in Git is exactly what reaches the device. That's a strong compliance argument.

Happy to go deeper on any of these.

Soften dry-run claims, add concurrency and merge queue workflow changes,
GitLab schedule and approval details, the full gitops user command,
team vs. fleet terminology, an accurate starter repo layout, GitOps mode
exceptions, and a section on patterns that break at scale.

This branch was previously deployed

1 inactive deployment
Docker Hub — df506c92 Deployed Dec 3, 2026 by kitzy via publish #118867
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants