--- title: '`glab cluster agent bootstrap`' stage: AI Clients group: Developer Clients info: To determine the technical writer assigned to the Stage/Group associated with this page, see --- Bootstrap a GitLab Agent for Kubernetes in a project. ## Synopsis Bootstrap a GitLab Agent for Kubernetes (agentk) in a project. The first argument must be the name of the agent. It requires the `kubectl` and `flux` commands to be accessible via `$PATH`. This command consists of multiple idempotent steps: 1. Register the agent with the project. 2. Configure the agent. 3. Configure an environment with dashboard for the agent. 4. Configure an environment with dashboard for FluxCD (if `--create-flux-environment`). 5. Create a token for the agent. - If the agent has reached the maximum amount of tokens, the one that has not been used the longest is revoked and a new one is created. - If the agent has not reached the maximum amount of tokens, a new one is created. 6. Push the Kubernetes Secret that contains the token to the cluster. 7. Create Flux HelmRepository and HelmRelease resources. 8. Commit and Push the created Flux Helm resources to the manifest path. 9. Trigger Flux reconciliation of GitLab Agent HelmRelease (unless `--no-reconcile`). ```plaintext glab cluster agent bootstrap [flags] ``` ## Aliases ```plaintext bs ``` ## Examples ```console # Bootstrap "my-agent" to the root of the Git project in CWD, and trigger reconciliation glab cluster agent bootstrap my-agent # Bootstrap "my-agent" to "manifests/" of the Git project in CWD, and trigger reconciliation # Especially useful when "flux bootstrap gitlab --path manifests/" is used. # Make sure that the "--path" from the "flux bootstrap gitlab" command matches # the "--manifest-path" of the "glab cluster agent bootstrap" command. glab cluster agent bootstrap my-agent --manifest-path manifests/ # Bootstrap "my-agent" to "manifests/" of the Git project in CWD, and do not manually trigger a reconilication glab cluster agent bootstrap my-agent --manifest-path manifests/ --no-reconcile # Bootstrap "my-agent" without configuring an environment glab cluster agent bootstrap my-agent --create-environment=false # Bootstrap "my-agent" and configure an environment with custom name and Kubernetes namespace glab cluster agent bootstrap my-agent --environment-name production --environment-namespace default # Bootstrap "my-agent" without configuring a FluxCD environment glab cluster agent bootstrap my-agent --create-flux-environment=false # Bootstrap "my-agent" and configure a FluxCD environment with custom name and Kubernetes namespace glab cluster agent bootstrap my-agent --flux-environment-name production-flux --flux-environment-namespace flux-system # Bootstrap "my-agent" and pass additional GitLab Helm Chart values from a local file glab cluster agent bootstrap my-agent --helm-release-values values.yaml # Bootstrap "my-agent" and pass additional GitLab Helm Chart values from a Kubernetes ConfigMap glab cluster agent bootstrap my-agent --helm-release-values-from ConfigMap/agent-config # Bootstrap "my-agent" and commit with custom user glab cluster agent bootstrap my-agent --commit-author-name="Tanuki" --commit-author-email="tanuki@example.com" # Bootstrap "my-agent" with authenticated API user glab cluster agent bootstrap my-agent --use-api-commit-author ``` ## Options ```plaintext --commit-author-email string The Git commit author email to use. Conflicts with '--use-api-commit-author'. (default "noreply@glab.gitlab.com") --commit-author-name string The Git commit author name to use. Conflicts with '--use-api-commit-author'. (default "glab") --create-environment Create an environment for the GitLab Agent. (default true) --create-flux-environment Create an environment for FluxCD. Affects only the environment creation, not the use of Flux itself. Flux is always required for the bootstrap process. (default true) --environment-flux-resource-path string Flux resource path of the environment for the GitLab Agent. (default "helm.toolkit.fluxcd.io/v2beta1/namespaces//helmreleases/") --environment-name string Name of the environment for the GitLab Agent. (default "/") --environment-namespace string Kubernetes namespace of the environment for the GitLab Agent. (default "") --flux-environment-flux-resource-path string Flux resource path of the environment for FluxCD. (default "kustomize.toolkit.fluxcd.io/v1/namespaces/flux-system/kustomizations/flux-system") --flux-environment-name string Name of the environment for FluxCD. (default "/") --flux-environment-namespace string Kubernetes namespace of the environment for FluxCD. (default "") --flux-source-name string Flux source name. (default "flux-system") --flux-source-namespace string Flux source namespace. (default "flux-system") --flux-source-type string Source type of the flux-system, like Git, OCI, or Helm. (default "git") --gitlab-agent-token-secret-name string Name of the Secret where the token for the GitLab Agent is stored. The helm-release-target-namespace is implied for the namespace of the Secret. (default "gitlab-agent-token") --helm-release-filepath string File path within the GitLab Agent project to commit the Flux HelmRelease to. (default "gitlab-agent-helm-release.yaml") --helm-release-name string Name of the Flux HelmRelease manifest. (default "gitlab-agent") --helm-release-namespace string Namespace of the Flux HelmRelease manifest. (default "flux-system") --helm-release-target-namespace string Namespace of the GitLab Agent deployment. (default "gitlab-agent") --helm-release-values strings Local path to values.yaml files. Multiple files can be comma-separated or specified by repeating the flag. --helm-release-values-from strings Kubernetes object reference that contains the values.yaml data key in the format '/', where 'kind' must be one of: (Secret, ConfigMap). Multiple references can be comma-separated or specified by repeating the flag. --helm-repository-address string Address of the HelmRepository. (default "https://charts.gitlab.io") --helm-repository-filepath string File path within the GitLab Agent project to commit the Flux HelmRepository to. (default "gitlab-helm-repository.yaml") --helm-repository-name string Name of the Flux HelmRepository manifest. (default "gitlab") --helm-repository-namespace string Namespace of the Flux HelmRepository manifest. (default "flux-system") -b, --manifest-branch string Branch to commit the Flux Manifests to. Defaults to the project default branch. -p, --manifest-path string Location of directory in Git repository for storing the GitLab Agent for Kubernetes Helm resources. --no-reconcile Do not trigger Flux reconciliation for GitLab Agent for Kubernetes Flux resource. --use-api-commit-author When creating Git commits use the user from the authenticated API request. Conflicts with '--commit-author-name' and '--commit-author-email'. ``` ## Options inherited from parent commands ```plaintext -h, --help Show help for this command. -R, --repo string Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted. ```