This guide assumes you are familiar with Argo CD and its basic concepts. See the Argo CD documentation for more information.
- Installed kubectl command-line tool
- Have a kubeconfig file (default location is
~/.kube/config
)
Make sure to have a valid token
export GIT_TOKEN=ghp_PcZ...IP0
You can use any clone URL to a valid git repo, provided that the token you supplied earlier will allow cloning from, and pushing to it. If the repository does not exist, bootstrapping it will also create it as a private repository.
export GIT_REPO=https://github.com/owner/name
If you want the autopilot-managed folder structure to reside under some sub-folder in your repository, you can also export the following env variable:
export GIT_REPO=https://github.com/owner/name/some/relative/path
If you want to use a specific branch for your GitOps repository operations, you can use the ref
query parameter:
export GIT_REPO=https://github.com/owner/name?ref=gitops_branch
!!! note
When running commands that commit or write to the repository, the value of ref
can only be a branch.
!!! tip
When running commands that commit or write to the repository you may also specify the -b
, this would create the branch specified in ref
if it doesn't exist.
Note that when doing so the new branch would be create from the default branch.
You can add the --provider
flag to the repo bootstrap
command, to enforce using a specific provider when creating a new repository. If the value is not supplied, the code will attempt to infer it from the clone URL.
Autopilot currently support github, gitlab, bitbucket-server (on-prem only), azure devops, and gitea as SCM providers.
All the following commands will use the variables you supplied in order to manage your GitOps repository.
argocd-autopilot repo bootstrap
The execution might take several minutes, while your k8s cluster downloads the required images for Argo CD. Once it completes, you will get the initial Argo CD admin password, as well as the command to run to enable port-forwarding:
INFO argocd initialized. password: pfrDVRJZtHYZKzBv
INFO run:
kubectl port-forward -n argocd svc/argocd-server 8080:80
(Your initial password will be different)
Execute the port forward command, and browse to http://localhost:8080. Log in using username admin
, and the password from the previous step. your initial Argo CD deployment should look like this:
argocd-autopilot repo bootstrap --recover \
--app "github.com/git-user/repo-name/bootstrap" #optional
In case of a cluster failure, you can recover argo-cd from an existing repository using --recover
flag. You can optionally use it with --app
flag to specify the path to the existing argo-cd manifests.
Using Argo CD HA with Argo CD Autopilot is fully supported. Bootstrap Argo CD with high-availability using the App Specifier model argocd-autopilot repo bootstrap --app https://github.com/argoproj-labs/argocd-autopilot/manifests/ha
.
- autopilot-bootstrap - References the
bootstrap
directory in the GitOps repository, and manages the other 2 applications - argo-cd - References the
bootstrap/argo-cd
folder, and manages the Argo CD deployment itself (including Argo CD ApplicationSet) - root - References the
projects
directiry in the repo. The folder contains only an emptyDUMMY
file after the bootstrap command, so no projects will be created
Execute the following commands to create a testing
project, and add a example application to it:
argocd-autopilot project create testing
argocd-autopilot app create hello-world --app github.com/argoproj-labs/argocd-autopilot/examples/demo-app/ -p testing --wait-timeout 2m
* notice the trailing slash in the URL
After the application is created, and after Argo CD has finished its sync cycle, your new project will appear under the Root application:
And the "hello-world" application will also be deployed to the cluster:
The following command will clear your entire GitOps Repository of related files, and your k8s cluster from any resources autopilot resources
argocd-autopilot repo uninstall