[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-08。"],[],[],null,["# About fleet packages\n\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page explains fleet packages, the `FleetPackage` API, and how they relate\nto Config Sync.\n\nA `FleetPackage` is a declarative API that lets you manage packages across a\nfleet. A **fleet package** is a set of Kubernetes YAML manifests that define\ncluster configuration. By using fleet packages, you\ncan deploy packages through an all-at-once or progressive rollout to clusters\nthat are registered to your fleet.\n\nYou define each `FleetPackage` object once, and then you can update that package\nwith a new revision. When you apply a new revision, the fleet package service picks up\nthose changes and deploys them to your clusters.\n\nBenefits\n--------\n\nUse fleet packages to deploy Kubernetes resources across clusters that\nare registered to a fleet. After you create and apply a fleet package, the\nfleet package automatically deploys the Kubernetes configuration files in the\nGit repository to the new cluster. Fleet packages builds upon Config Sync's\nbenefits like automatic drift correction, and offers the following unique\nadvantages:\n\n- **Automate resource rollout:** After you set up a fleet package, the\n Kubernetes resources it points to are automatically deployed by\n the fleet package service on all clusters.\n\n- **Configure new clusters automatically**: If you configure a fleet package\n and then later add new clusters to a fleet, any resources defined by the\n fleet package are automatically deployed to the new cluster.\n\n- **Manage Kubernetes configuration at scale:** Instead of managing clusters\n one-by-one, use fleet packages to deploy resources to an entire fleet of\n clusters.\n\n- **Minimize the impact of incorrect changes:** Choose a maximum number of\n clusters to deploy resources to at once. You can closely monitor the changes\n to each cluster to ensure that incorrect changes don't impact your entire\n fleet.\n\n- **Simplify Config Sync configuration:** Fleet packages uses\n Cloud Build to authenticate to Git, meaning you authenticate once per\n project instead of once per `RootSync` or `RepoSync` object.\n\nYou might prefer to use Config Sync with `RootSync` or `RepoSync` objects\ninstead of fleet packages if one or more of the following scenarios applies to\nyou:\n\n- You manage a small number of clusters.\n\n- You need more control over how resources are deployed to your clusters,\n beyond what the fleet package API provides with labels and variants.\n\nRequirements and limitations\n----------------------------\n\n- Only Git repositories are supported as the when\n configuring a fleet package.\n\n- The Kubernetes resources stored in Git must represent the end state of the\n resource. Additional overlays to transform the resource stored in Git are\n not supported. For more information about the differences in these\n resources, see [Best practice: Create *WET* repositories](/kubernetes-engine/enterprise/config-sync/docs/concepts/gitops-best-practices#create-wet-repo).\n\n- The `FleetPackage` API is available only in the `us-central1` region. You\n can still deploy to clusters in different regions, but you must set up\n Cloud Build and configure the gcloud CLI in `us-central1`.\n\nArchitecture\n------------\n\nYou can use the `FleetPackage` API to deploy Kubernetes manifests to a fleet of\nclusters. The `FleetPackage` API uses Cloud Build to sync and fetch\nKubernetes resources from your Git repository. The fleet package service then\ndeploys those resources to your clusters.\n\nExample use cases\n-----------------\n\nYou can use fleet packages to deploy resources from a Git repository to your\nentire fleet of clusters. You can also configure your fleet package to\ncontrol how, where, and what type of resources are deployed.\n\nThe following section shows examples of different `FleetPackage` configurations.\nFor more detailed information about applying fleet packages, see\n[Deploy fleet packages](/kubernetes-engine/enterprise/config-sync/docs/how-to/fleet-packages).\n\n### Deployment to all clusters in a fleet\n\nThe following `FleetPackage` uses a rolling strategy to deploy\nKubernetes resources to three clusters at a time and targets\nall clusters in a fleet: \n\n resourceBundleSelector:\n cloudBuildRepository:\n name: projects/my-project/locations/us-central1/connections/my-connection/repositories/my-repo\n tag: v1.0.0\n serviceAccount: projects/my-project/serviceAccounts/my-service-account@my-project.iam.gserviceaccount.com\n target:\n fleet:\n project: projects/my-project\n rolloutStrategy:\n rolling:\n maxConcurrent: 3\n\n### Deployment to a subset of clusters\n\nThe following `FleetPackage` uses a label selector to deploy Kubernetes resources\nonly to clusters with the membership label `country` that matches `\"us\"`\nin the fleet: \n\n resourceBundleSelector:\n cloudBuildRepository:\n name: projects/my-project/locations/us-central1/connections/my-connection/repositories/my-repo\n tag: v1.0.0\n serviceAccount: projects/my-project/serviceAccounts/my-service-account@my-project.iam.gserviceaccount.com\n target:\n fleet:\n project: projects/my-project\n selector:\n matchLabels:\n country: \"us\"\n rolloutStrategy:\n rolling:\n maxConcurrent: 3\n\n### Deployment of variant resources to a cluster\n\nFor this example, in your Git repository, you have a folder named \"deployments\"\nthat contains two different deployment specs: \n\n### Replicas: 3\n\n```yaml\n # small.yaml\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: nginx-deployment\n labels:\n app: nginx\n spec:\n replicas: 3\n selector:\n matchLabels:\n app: nginx\n template:\n metadata:\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx:1.14.2\n ports:\n - containerPort: 80\n \n```\n\n### Replicas: 10\n\n```yaml\n # large.yaml\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: nginx-deployment\n labels:\n app: nginx\n spec:\n replicas: 10\n selector:\n matchLabels:\n app: nginx\n template:\n metadata:\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx:1.14.2\n ports:\n - containerPort: 80\n \n```\n\nYou can use variants to deploy either the \"small\" or \"large\" deployments\nto different clusters. Each cluster has a label of either\n`nginx-size=small` or `nginx-size=large`.\n\nThe `FleetPackage` in this example would resemble the following: \n\n resourceBundleSelector:\n cloudBuildRepository:\n name: projects/my-project/locations/us-central1/connections/my-connection/repositories/my-repo\n tag: v1.0.0\n serviceAccount: projects/my-project/serviceAccounts/my-service-account@my-project.iam.gserviceaccount.com\n path: deployments\n variantsPattern: \"*.yaml\"\n rolloutStrategy:\n rolling:\n maxConcurrent: 2\n target:\n fleet:\n project: projects/my-project\n variantSelector:\n variantNameTemplate: ${membership.labels['nginx-size']}\n\nWhat's next\n-----------\n\n[Deploy fleet packages](/kubernetes-engine/enterprise/config-sync/docs/how-to/fleet-packages)"]]