Install Flux CLI

Install the Flux CLI using the following command:

curl -s https://fluxcd.io/install.sh | sudo bash

Configure GitHub Repository

1. Create an Empty Repository

  • Go to GitHub and create a new, empty repository.

2. Generate a Personal Access Token

CategoryPermission
MetadataRead-only
ActionsRead and write
AdministrationRead and write
Commit statusesRead and write
ContentsRead and write
Dependabot alertsRead and write
Dependabot secretsRead and write
DeploymentsRead and write
DiscussionsRead and write
EnvironmentsRead and write
IssuesRead and write
Merge queuesRead and write
Pull requestsRead and write
Repository security advisoriesRead and write
Secret scanning alertsRead and write
SecretsRead and write
VariablesRead and write
WebhooksRead and write
WorkflowsRead and write

Bootstrap the Cluster

1. Export Required Variables

Export your GitHub username, repository name, and token as environment variables:

export GITHUB_USER=<your-github-username>
export REPOSITORY=<your-repository-name>
export GITHUB_TOKEN=<your-personal-access-token>

2. Run Flux Bootstrap Command

Execute the following command to bootstrap Flux in your cluster:

flux bootstrap github \
  --owner=$GITHUB_USER \
  --repository=$REPOSITORY \
  --branch=main \
  --path=clusters/production \
  --personal

3. Clone the Repository Locally

Choose a directory to clone the repository and execute:

cd ~
git clone https://oauth2:$GITHUB_TOKEN@github.com/$GITHUB_USER/$REPOSITORY

Local Repository Structure

After completing the bootstrap process, your local repository folder structure should resemble the following:

.
├── clusters
│   └── production
│       └── flux-system
│           ├── gotk-components.yaml
│           ├── gotk-sync.yaml
│           └── kustomization.yaml
└── README.md