Last active
June 30, 2025 20:58
-
-
Save jandubois/4d17492d2dff935c44925b47d032cae9 to your computer and use it in GitHub Desktop.
Deploy Fleet with sample repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| apiVersion: helm.cattle.io/v1 | |
| kind: HelmChart | |
| metadata: | |
| name: fleet-crd | |
| namespace: kube-system | |
| spec: | |
| repo: https://rancher.github.io/fleet-helm-charts/ | |
| chart: fleet-crd | |
| targetNamespace: cattle-fleet-system | |
| createNamespace: true | |
| --- | |
| apiVersion: helm.cattle.io/v1 | |
| kind: HelmChart | |
| metadata: | |
| name: fleet | |
| namespace: kube-system | |
| spec: | |
| repo: https://rancher.github.io/fleet-helm-charts/ | |
| chart: fleet | |
| targetNamespace: cattle-fleet-system | |
| createNamespace: true | |
| --- | |
| apiVersion: v1 | |
| kind: ServiceAccount | |
| metadata: | |
| name: fleet-setup | |
| namespace: kube-system | |
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRole | |
| metadata: | |
| name: fleet-setup | |
| rules: | |
| - apiGroups: ["fleet.cattle.io"] | |
| resources: ["gitrepos"] | |
| verbs: ["create", "get", "list"] | |
| - apiGroups: [""] | |
| resources: ["namespaces"] | |
| verbs: ["create", "get"] | |
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRoleBinding | |
| metadata: | |
| name: fleet-setup | |
| roleRef: | |
| apiGroup: rbac.authorization.k8s.io | |
| kind: ClusterRole | |
| name: fleet-setup | |
| subjects: | |
| - kind: ServiceAccount | |
| name: fleet-setup | |
| namespace: kube-system | |
| --- | |
| apiVersion: batch/v1 | |
| kind: Job | |
| metadata: | |
| name: fleet-gitrepo-setup | |
| namespace: kube-system | |
| spec: | |
| template: | |
| spec: | |
| serviceAccountName: fleet-setup | |
| restartPolicy: OnFailure | |
| containers: | |
| - name: setup | |
| image: bitnami/kubectl:latest | |
| command: | |
| - /bin/sh | |
| - -c | |
| - | | |
| # Wait for Fleet CRDs to be available | |
| kubectl wait --for condition=established --timeout=300s crd/gitrepos.fleet.cattle.io | |
| # Create fleet-local namespace if it doesn't exist | |
| kubectl create namespace fleet-local --dry-run=client -o yaml | kubectl apply -f - | |
| # Create the GitRepo resource | |
| cat <<EOF | kubectl apply -f - | |
| apiVersion: fleet.cattle.io/v1alpha1 | |
| kind: GitRepo | |
| metadata: | |
| name: sample | |
| namespace: fleet-local | |
| spec: | |
| repo: "https://github.com/rancher/fleet-examples" | |
| paths: | |
| - simple | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment